Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/ApiResponseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace SurazDott\ApiResponse;

use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Support\ServiceProvider;
use SurazDott\ApiResponse\Exceptions\Handler as ApiExceptionHandler;
use SurazDott\ApiResponse\Http\ApiResponse;

class ApiResponseServiceProvider extends ServiceProvider
Expand All @@ -13,6 +15,7 @@ class ApiResponseServiceProvider extends ServiceProvider
public function register(): void
{
$this->registerFacades();
$this->app->singleton(ExceptionHandler::class, ApiExceptionHandler::class);
}

/**
Expand Down
32 changes: 32 additions & 0 deletions src/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace SurazDott\ApiResponse\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
\SurazDott\ApiResponse\Exceptions\ApiValidationException::class,
\SurazDott\ApiResponse\Exceptions\ApiResponseException::class,
];

/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception): void
{
parent::report($exception);
}
}
Loading