Errors and error recovery

tiff2afp divides errors into fatal and non-fatal. The fatal error categories are:

  • Errors in the user-specified parameters, either in the environment variables, the configuration file, or the command line arguments. These errors include unrecognized options, incorrect values for parameters, or inability to open the configuration file or the output file.
  • Out of memory errors. The requested memory is larger than the memory specified using the -M option or the dynamic memory allocation has failed.
  • Disk space errors. The transform guards against trying to write to a full file system. See the -ms and -msf options for setting the minimum free disk space requirements. If the file system is full, the transform deletes the partial output file before terminating.
  • Internal errors.
In the case of a fatal error, the last output page might not be complete.

Errors found in the TIFF files are non-fatal and tiff2afp tries to recover from them. These errors include not being able to open an input file, an input file not being a TIFF file, or an input file containing features that cannot be processed. If the transform fails to open 15 or more input files, it assumes an error in the parameter list (for example, -f was used with a file that does not contain a file list) and terminates.

If an error is found in a file, the transform tries to recover with the next image in the file. If such recovery is not possible, tiff2afp tries to recover with the next input file. In both cases, a warning message is issued. Errors and warnings are output to standard error.

For example, let a directory tFiles contain files file1.tif, file1.txt, file2.tif and file3.tif, where file1.txt is an ASCII file. Invoking the transform with:

tiff2afp tFiles
processes the bi-level images in all three TIFF files correctly. A warning is issued that file1.txt is not a TIFF file.

Non-fatal errors can be made fatal by using the option -term or the corresponding environment variable or configuration file entry. If -term is set, the transform terminates in error if it encounters an error in the TIFF data stream.