IPB_Session interface:
ThrowException method
Description
Throws a PowerBuilder exception or inherited exception, and
replaces the existing exception if there is one.
Syntax
ThrowException (pbobject ex)
Argument
|
Description
|
ex
|
The exception to be thrown. The exception
must first be created with NewObject.
|
Return Values
None.
Examples
This code creates a new exception object in the class user_exception_pspp, invokes
its SetMessage function, and throws the exception:
pbclass cls;
pbmethodID mid;
pbobject ex;
pbgroup group;
PBCallInfo* ci = new PBCallInfo;
// Throw exception
group = session-> FindGroup("user_exception_pspp",
pbgroup_userobject);
if (group==NULL)
return;
cls = session->FindClass(group, "user_exception_pspp");
if (group==NULL)
return;
ex = session -> NewObject(cls);
mid = session-> GetMethodID(cls,
"setmessage", PBRT_FUNCTION, "QS");
session-> InitCallInfo(cls,mid,ci);
ci-> pArgs[0].SetPBString(session, "Test exception");
session -> InvokeObjectFunction(ex,mid,ci);
session -> ThrowException(ex);
if (!ThrowToPB)
session -> ClearException();
session -> FreeCallInfo(ci);
delete ci;
return;
See Also