优化会员限制

This commit is contained in:
kuaifan
2021-12-10 06:34:21 +08:00
parent 7ef966536d
commit 7e67fa3076
6 changed files with 42 additions and 9 deletions

View File

@@ -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优雅记录laravel日志
* @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);
}
}
}