Skip to content

Commit

Permalink
Better errors catching
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmorbo committed Feb 12, 2023
1 parent d7a3d4f commit 6130dd8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Controller/InstanceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -259,7 +260,7 @@ function ($video) use ($request, $response) {

return $response;
},
function (TrassirException $e) {
function (Exception $e) {
return new JsonResponse(['error' => $e->getMessage()], 404);
}
);
Expand Down

0 comments on commit 6130dd8

Please sign in to comment.