Filtering tool messages by the level of severity
As I mentioned in the last recipe, all tools generate a number of messages that can be classified as information, warnings, or error messages. The GetMessages()
method accepts a parameter that allows you to filter the messages that are returned. For example, you may not be interested in the informative or warning messages in your script. However, you will certainly be interested in error messages as they indicate a fatal error that will not allow a tool to successfully execute. Using GetMessages()
, you can filter the returned message to include only error messages.
Getting ready
Messages are classified into one of three types, which are indicated by the level of severity. Informational messages
provide descriptive information concerning things, such as a tools progress, start and end times of the tool, output data characteristics, and much more. The severity of an informational message is indicated by a value of 0
. Warning messages are generated...