refactor code-style rector and php-insight

This commit is contained in:
2024-01-27 15:10:30 +03:00
parent 5dbb4a0275
commit c66ba7feaf
34 changed files with 55 additions and 47 deletions

View File

@@ -2,7 +2,10 @@
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Sentry\Laravel\Integration;
use Throwable;
@@ -35,6 +38,14 @@ class Handler extends ExceptionHandler
*/
public function register()
{
$this->renderable(static function (Exception $exception, Request $request) {
if ($exception instanceof \DomainException && $request->expectsJson()) {
return response()->json([
'message' => $exception->getMessage(),
], Response::HTTP_UNPROCESSABLE_ENTITY);
}
});
$this->reportable(function (Throwable $e) {
Integration::captureUnhandledException($e);
});