Open Krispian opened 9 years ago
you can use ApnsPHP_Exception
to catch
the exception
try {
$push->connect();
} catch (ApnsPHP_Exception $e) {
//log($e->getTraceAsString(), LOG_ERR);
} catch (Exception $e) {
//log($e->getTraceAsString(), LOG_ERR);
}
Even I'm facing a similar issue. I am using this library in a cron job and if there are any exceptions thrown, then the code just exits! This stalls processing of other items in the loop resulting in same push notifications being sent multiple times cause they all end up getting stuck on the one errornous device token. I will have to now sit and re write all thrown exceptions to have catch statements. At least the library should've had an option to log the exceptions instead of just throwing them without catching them.
Hello! Im use your cool lib but I have a question: Why in Absrtact class, if not connect to server sending uncaught exception? Why not wrap it in try...catch.. block that script not died?
if (!$this->_hSocket) { throw new ApnsPHP_Exception( "Unable to connect to '{$sURL}': {$sError} ({$nError})" ); }