Add report() helper function

This commit is contained in:
printempw 2018-07-21 21:52:43 +08:00
parent b6fb15cc10
commit b047ee8fda
2 changed files with 14 additions and 1 deletions

View File

@ -197,7 +197,7 @@ class AuthController extends Controller
Log::info("[Password Reset] Mail has been sent to [{$request->input('email')}] with token [$token]");
} catch (\Exception $e) {
// Write the exception to log
app(\Illuminate\Foundation\Exceptions\Handler::class)->report($e);
report($e);
return json(trans('auth.mail.failed', ['msg' => $e->getMessage()]), 2);
}

View File

@ -493,3 +493,16 @@ if (! function_exists('get_db_config')) {
return config("database.connections.$type");
}
}
if (! function_exists('report')) {
/**
* Report an exception.
*
* @param \Exception $exception
* @return void
*/
function report($exception)
{
app(Illuminate\Contracts\Debug\ExceptionHandler::class)->report($exception);
}
}