重写report优雅记录
This commit is contained in:
parent
7ef966536d
commit
a303a60c4e
@ -5,6 +5,7 @@ namespace App\Exceptions;
|
||||
use App\Module\Base;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
@ -57,4 +58,18 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重写report优雅记录
|
||||
* @param Throwable $e
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function report(Throwable $e)
|
||||
{
|
||||
if ($e instanceof ApiException) {
|
||||
Log::error($e->getMessage(), ['exception' => ' at ' . $e->getFile() .':' . $e->getLine()]);
|
||||
} else {
|
||||
parent::report($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user