SetMessage
PowerScript function
Description
Sets an error message for an object of type Throwable.
Syntax
|
1 |
throwableobject.SetMessage (newMessage ) |
|
Argument |
Description |
|---|---|
|
throwableobject |
Object of type Throwable for which you want to set an |
|
newMessage |
String containing the message you want to set. Must be |
Return value
None
Usage
Use to set a customized message on a user-defined exception object.
Although it is possible to use SetMessage to modify the preset error
messages for RuntimeError objects, this is not recommended.
Examples
This statement is an example of a message set on a user object of
type Throwable:
|
1 |
MyException.SetMessage ("MyException thrown") |
This example uses SetMessage in the try-catch block for a
user-defined function that takes an input value from one text box and
outputs the arccosine for that value into another text box:
|
1 2 3 4 5 6 7 8 9 10 11 12 |
uo_exception lu_error Double ld_num ld_num = Double (sle_1.text) TRY sle_2.text = string (acos (ld_num)) CATCH (runtimeerror er) lu_error = Create uo_exception lu_error.SetMessage("Value must be between -1" +& "and 1") Throw lu_error END TRY |
See also