Add (inspector)

Add (openai): debugging points for inspector
This commit is contained in:
2023-09-25 20:30:36 +08:00
parent 8fc46dc80c
commit 2ddc688926
4 changed files with 170 additions and 4 deletions

View File

@@ -3,6 +3,8 @@
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Illuminate\Auth\AuthenticationException;
use Throwable;
class Handler extends ExceptionHandler
@@ -20,11 +22,54 @@ class Handler extends ExceptionHandler
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register(): void
public function register()
{
$this->reportable(function (Throwable $e) {
$this->reportable(function (Throwable $exception) {
//
});
$this->renderable(function (NotFoundHttpException $e, $request) {
if ($request->is('api/*')) {
return response()->json([
'status' => -1,
], 404);
} else {
return redirect()->route('front.home');
}
});
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Throwable $exception)
{
if ($exception instanceof NotFoundHttpException)
{
}
else if ($exception instanceof AuthenticationException)
{
}
else
{
inspector()->reportException($exception);
}
//default laravel response
return parent::render($request, $exception);
}
}