Translating Error Messages

Note

These examples are not specific to any particular operating system.

Example 1

In this example, a command generates the following stderr file.

From the contents of the message file, we can see that the program failed to open a resource configuration file.

Either of the following translation tables could match error messages in the message file. Message masks should be general enough to match a set of error messages.

Translation Table 1

Translation Table 1 will result in a match if any input line contains the word error. The resulting exit code will be 8 if a match occurs.

Translation Table 2

Translation Table 2 will result in a match only if the exact message text "Ending due to error." appears as a line in the input file. This is less general, but may be sufficient for this command.

Example 2

(This example continues from Example 1.)

In this example, the command now generates the following stderr file.

From the contents of the message file, we can see that the program failed to open a resource configuration file /etc/arc.rc, but successfully opened file /usr/etc/arc.rc.

Translation table

The following translation table is one of many that could match error messages in the message file.

Translation Table 1 contains three entries:

  • First entry matches against a specific error message that always indicates an error if present.
  • Second and third entries match messages produced by resource configuration file processing.

Components

Universal Message Translator