Geoprocessing messages


In this topic


About geoprocessing messages

During execution of a tool, messages are relayed back to the geoprocessor. These messages include when the operation started, the parameter values used, the operation's progress, and warnings of problems or errors. All communication between a tool, the geoprocessor, and the user is conducted via this messaging.
Geoprocessing programs are frequently automated without user interaction. Since geoprocessing tools do not assume there is direct interaction with a user, message or other types of dialog boxes are not used during execution.

Informative messages

A tool message is classified as an informative message (warning or error message). A message type is indicated by its severity property, which is a numeric value. An informative message can be used to indicate any event that does not reflect a problem or error. Typical informative messages indicate a tool's progress, when a tool started or completed, output data characteristics, or tool results. A severity value of 0 is used for informative messages, since they require no action from a user or program.

Warning messages

Warning messages are generated when a tool has a problem during execution or when the result is not what the user expects. A user or program can take action when a warning is returned, such as canceling the tool's execution or making another parameter choice. For example, defining a coordinate system for a dataset that already has a coordinate system generates a warning. The tool still executes, but it may not create the desired result if the user did not intend to alter the existing coordinate system. A severity value of 1 is given to warning messages.

Error messages

Error messages indicate a critical event that prevents a tool from executing. Errors are generated when one or more parameters have invalid values or when a critical execution process or routine fails. Paths to data that does not exist, an invalid keyword, or corrupted data are examples that cause an error. A severity value of 2 is given to error messages to indicate an action is required by the program or user. 

Error handling

Most programming languages have built-in error handling, allowing programs to logically continue execution when an error occurs. When an error message from a tool is returned to the geoprocessor, a system error is generated (can be caught by a program's error handling routine). If a program does not have an error handling routine, it fails immediately. Use error handling routines to manage errors and improve a program's usability.

List of messages

Messages from the last tool the geoprocessor executed are maintained as a list of messages. A GPMessage class contains a message's text and its severity value. Using the GPMessage class, you can access the message list to retrieve, add, or clear messages.