Errors and error recovery
jpeg2afp 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.
Errors found in the JPEG files are non-fatal and jpeg2afp tries to recover from them. These errors include not being able to open an input file, an input file not being a JPEG 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 input file. A warning message is issued. Errors and warnings are output to standard error.
For example, let a directory tFiles
contain
files file1.jpg
, file1.txt
, file2.jpg
and file3.jpg
,
where file1.txt
is an ASCII file. Invoking the transform
with:
jpeg2afp tFilesprocesses the bi-level images in all three JPEG files correctly. A warning is issued that
file1.txt
is
not a JPEG 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 JPEG data stream.