I use the SaaS service and the exception logging service called Rollbar. In my code, I have a static Rollbar object that I can use to report exceptions from the service.
For instance:
try { ... throw new SomeException(); ... } catch (SomeException $e) { Rollbar::report_exception($e); }
My question is: can I instantiate an exception without throwing it, as if it were any other normal object, and are there any reservations?
I would like to do the following:
if($api_response_ok) { // Do some stuff ... } else { Rollbar::report_exception(new ApiException($api_error_msg)); } // Script execution continues...
source share