In this topic
About messages
During execution of a tool, messages are relayed back to the geoprocessor. These messages include such information as when the operation started, what parameter values are being used, the operation's progress, and warnings of potential problems or errors. All communication between a tool, the geoprocessor, and the user is conducted via this messaging. Geoprocessing programs are frequently run in an automated fashion without user interaction. Since geoprocessing tools do not assume there is direct interaction with a user, they never use message boxes or other types of dialog boxes during their execution.
A tool message is classified as an informative, a warning or an error message. A message's type is indicated by its severity property, which is a numeric value. The severity value is 0, 1 and 2 for informative, warning and error message respectively. See Understanding message types and severity in Desktop help for more information.
Informative messages
An informative message can be used to indicate any event that does not reflect a problem or possible error. Typical informative messages indicate a tool's progress, what time a tool started or completed, output data characteristics, or tool results (succeeded or failed). 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 experiences a situation that can cause a problem during its execution or when the result is not be 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. Defining a coordinate system for a dataset that already has a coordinate system defined, for example, 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 will prevent a tool from executing. Errors are generated when one or more parameters have invalid values or when a critical execution process or routine has failed. Paths to data that does not exist, an invalid keyword, or corrupted data are examples of situations that will cause an error. Errors have a severity value of 2, indicating an action is required by the program or user.
Non-geoprocessing error
Most programming languages have built-in error handling, allowing programs to continue execution in a logical fashion when an error occurs. When an error message from a tool is returned to the geoprocessor, it generates a system error, which may be caught by a program's error-handling routine. If a program does not have an error-handling routine, it will fail immediately, which decreases its robustness. Use error-handling routines to manage errors and improve a program's usability.
See Also:
Working with result objectsTool return values
How to get returned messages
Errors and exception handling in geoprocessing