Phantom Documentation

[Help Home] [Phantom Home]

void exception.SetWarning(string)

Return Type: void
Parameters: string WarnMessage


SetWarning sets the exception state to Warning and sets the message to WarnMessage. When a warning is thrown, a warning message appears in the output. However, unlike an error or a failure, script execution continues nominally after a warning is thrown. A thrown warning will be caught and processed by try-catch statements.

Note that if a warning occurs in a user-defined function, the warning will not be thrown to the calling functions. Therefore, try-catch statements in the calling functions will not process warnings thrown in a user-defined function. To process a warning in a user defined function, the try-catch statement must be present inside the user-defined function. This is in contrast to unhandled errors and failures, which are passed back to the calling function or script and can be caught and processed there.

A thrown warning will increment the script warning counter. See GetWarningCount.

Example Code

exception Warn;
Warn.SetWarning("Warning Message");

** WARNING: (1) from 'Sample.psc' on line 4 - Warning Message

See exception for additional examples.

See Also: exception

Copyright 2000-2011 Phantom Automated Solutions