Tuesday, May 23, 2017

Lumen QueryException write to log

I'm using Lumen 5.3.* and I need to make QueryException write errors on the storage/logs/lumen.log.

Other validations are writing to the log file except for QueryException.

try {
    // throw here exception here
} catch (QueryException $e) {
    // do what ever
} catch (CustomException $e) {
    // do what ever
}

I have my CustomException extended to \Exception and use Handler class to to do report() as to why I am able to write to the log file. But the QueryException does not. (QueryException is a lumen vendor file)

I know it is possible to just to \Log() upon catch on the QueryException but I want to make things cleaner by not putting it this way.

Is there another way to do this aside from doing what was stated above?

Thanks in advance!



via basagabi

Advertisement