Resolved PBNI Exceptions
- How-to
- Roland Smith
- PowerBuilder
- Monday, 28 June 2021 02:46 AM UTC
Calling PB 2019-R3 object from C++. I'm getting 'Unhandled Exception' in the error object and no exception in the C++ code. Any idea?
The PowerBuilder function:
public function integer of_exception (integer ai_value) throws n_cst_exception;n_cst_exception ex
Integer li_calc
ex = Create n_cst_exception
ex.SetMessage("Something went wrong!")
Throw ex
li_calc = ai_value * ai_value
Return li_calc
end function
The C++ code:
try
{
// Call the function
session->InvokeObjectFunction(pbobj, mid, &ci);
// Was PB exception thrown?
if (session->HasExceptionThrown())
{
// Handle PB exception
session->ClearException();
WriteToLogFile(L"PB exception");
}
}
catch (...)
{
// Handle C++ exception
WriteToLogFile(L"C++ exception");
}
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.