ThrowException

PowerBuilder Native Interface

IPB_Session interface:

ThrowException method

Description

Syntax

ThrowException (pbobject ex)

Return Values

Examples

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