SetMessage PowerScript function
Description
Sets an error message for an object of type Throwable.
Syntax
|
1 |
<span>throwableobject</span>.<span>SetMessage</span> (<span>newMessage</span> ) |
|
Argument |
Description |
|---|---|
|
throwableobject |
Object of type Throwable for which you |
|
newMessage |
String containing the message you want |
Return Values
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 |
uo_exception lu_error |
|
1 |
Double ld_num |
|
1 |
ld_num = Double (sle_1.text) |
|
1 |
|
1 |
TRY |
|
1 |
sle_2.text = string (acos (ld_num)) |
|
1 |
CATCH (runtimeerror er) |
|
1 |
lu_error = Create uo_exception |
|
1 |
lu_error.SetMessage("Value must be between -1" +& |
|
1 |
"and 1") |
|
1 |
Throw lu_error |
|
1 |
END TRY |
See Also
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest