When Grav fires the onFatalException event, I would like to send myself a notice of the error with details. The notification works, but I can’t figure out where to grab exception details. Any ideas?
To be honest i’ve not tried adding additional handlers for this event as the only place it’s currently used (that I know of) is in the problems plugin. I’m not 100% sure that even works in that instance. I think Whoops might be handling the exception before this event is even fired.
Ok, i tested this a bit today. It is working fine after all. I created an onFatalExceptionevent in my testing plugin, and debugged it. It went in there fine. I was able to log out a message no problem. What I have added is the exception is now passed to the event so you can actually know what the exception was that cause the event in the first place: https://github.com/getgrav/grav/commit/d42786484f10a9ae23820400ace35867474498e0
Then you can use it like this:
public function onFatalException(Event $e)
{
$exception = $e['exception'];
$this->grav['log']->addCritical(">>> " . $exception->getMessage());
}
---