Skip to main content

Translating Error Messages

info

These examples are not specific to any particular operating system.

Example 1

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

Error opening rc file /etc/arc.rc
No rc file opened.
Ending due to error.

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


# UMET Translation Table 1

#

# Message Mask Exit Code

# ------------ ---------
"*error*" 8

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


# UMET Translation Table 2

#

# Message Mask Exit Code

# ------------ ---------
"Ending due to error." 8

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.

Error opening rc file /etc/arc.rc
Processing rc file /usr/etc/arc.rc
Ending successfully

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.


# UMET Translation Table 1

#

# Message Mask Exit Code

# ------------ ---------
"Ending due to error." 8
"Processing rc file *" 0
"Error opening rc file *" 8

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