SetMessage

Description

Sets an error message for an object of type Throwable.

Syntax

throwableobject.SetMessage (newMessage )

Argument

Description

throwableobject

Object of type Throwable for which you want to set an error message.

newMessage

String containing the message you want to set. Must be surrounded by quotation marks.


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:

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:

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

GetMessage