From 6130dd838f8b8c17b3d1421c721f5a8855ea4af9 Mon Sep 17 00:00:00 2001 From: Aleksandr Nikitin Date: Sun, 12 Feb 2023 15:33:40 +0300 Subject: [PATCH] Better errors catching --- src/Controller/InstanceController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Controller/InstanceController.php b/src/Controller/InstanceController.php index 1b175b3..76af439 100644 --- a/src/Controller/InstanceController.php +++ b/src/Controller/InstanceController.php @@ -7,6 +7,7 @@ use AlexMorbo\React\Trassir\TrassirHelper; use AlexMorbo\Trassir\TrassirException; use Clue\React\SQLite\DatabaseInterface; +use Exception; use Fig\Http\Message\StatusCodeInterface; use HttpSoft\Response\JsonResponse; use React\Http\Message\Response; @@ -140,7 +141,7 @@ function() use ($instance, $instanceId) { } ) ->otherwise( - fn(TrassirException $e) => new JsonResponse([ + fn(Exception $e) => new JsonResponse([ 'status' => 'error', 'error' => $e->getMessage() ], StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR) @@ -259,7 +260,7 @@ function ($video) use ($request, $response) { return $response; }, - function (TrassirException $e) { + function (Exception $e) { return new JsonResponse(['error' => $e->getMessage()], 404); } );