php - sfErrorNotifierPlugin on symfony task -
my application runs huge batch processing inside symfony task, , want notified php errors , uncaught exceptions.
so tried sferrornotifierplugin, , works great in web context (accessing application browser); problem can't make work on symfony tasks.
is there way make work in tasks?
sftask
has no exception handling web interface does, can work around it: exceptions thrown passed sferrornotifier::notifyexception
.
wrap task's execute
method in big try-catch block:
public function execute($arguments = array(), $options = array()) { try { //your code here } catch(exception $e) { sferrornotifier::notifyexception($e); //call notifier throw $e; //rethrow stop execution , avoid problems in special cases } }
keep in mind needs application parameter run correctly (uses settings app.yml).
Comments
Post a Comment