refactor: enhance plugin mechanism for better extensibility

This commit is contained in:
xboard
2025-01-26 02:31:57 +08:00
parent e858a7c6db
commit 0141c68167
6 changed files with 144 additions and 89 deletions
+14
View File
@@ -3,6 +3,7 @@
namespace App\Exceptions;
use App\Helpers\ApiResponse;
use App\Services\Plugin\InterceptResponseException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Support\Arr;
use Illuminate\View\ViewException;
@@ -68,6 +69,19 @@ class Handler extends ExceptionHandler
return parent::render($request, $exception);
}
/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
$this->renderable(function (InterceptResponseException $e) {
return $e->getResponse();
});
}
protected function convertExceptionToArray(Throwable $e)
{