Error Trapping #55
Answered
by
georged
smartinsight-at
asked this question in
Q&A
-
I am just getting started with this toolkit. I am trapping errors using the following. This seems to work.
Is there a better way? |
Beta Was this translation helpful? Give feedback.
Answered by
georged
Apr 1, 2021
Replies: 1 comment
-
catching exceptions is the standard way of trapping the error. What do you do with it is totally up to you. If you have a logger wired up then the error will appear in the log as well. For example: use Monolog\Logger;
use Monolog\Handler\StreamHandler;
$log = new Logger( 'whatever' );
$log->pushHandler(new StreamHandler('php://stdout', Logger::INFO));
$settings = new \AlexaCRM\WebAPI\OData\OnlineSettings();
$settings->setLogger( $log ); This will generate error information and dump it into stdout. Usually handlers created for logging into files, etc. HTH |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
georged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@smartinsight-at
catching exceptions is the standard way of trapping the error. What do you do with it is totally up to you. If you have a logger wired up then the error will appear in the log as well. For example:
This will generate error information and dump it into stdout. Usually handlers created for logging into files, etc.
HTH