Skip to content

Error Trapping #55

Answered by georged
smartinsight-at asked this question in Q&A
Discussion options

You must be logged in to vote

@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:

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

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by georged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants