From da4b6cd85098fbb69a035f5eed5873bddeca80a6 Mon Sep 17 00:00:00 2001 From: weichien00 Date: Sat, 3 Jul 2021 02:38:52 +0800 Subject: [PATCH] update: return TypeError exception with ApiResponseObject . #4 --- app/Classes/General/Abstracts/AbstractControllerLogic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Classes/General/Abstracts/AbstractControllerLogic.php b/app/Classes/General/Abstracts/AbstractControllerLogic.php index 2fdd0dab..9f8ba4b5 100644 --- a/app/Classes/General/Abstracts/AbstractControllerLogic.php +++ b/app/Classes/General/Abstracts/AbstractControllerLogic.php @@ -9,6 +9,7 @@ use App\Classes\ValueObjects\Constants\Notifications; use App\Classes\ValueObjects\Constants\HttpStatus; use App\Classes\ValueObjects\Response\ApiResponseObject; use ErrorException as GeneralExceptions; +use TypeError; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; @@ -60,7 +61,7 @@ abstract class AbstractControllerLogic return $response; - } catch (ErrorException|GeneralExceptions $exception){ + } catch (ErrorException|GeneralExceptions|TypeError $exception){ return (new ApiResponseObject($this->getNotificationTitle().' failed', $exception->getMessage(), $exception->getCode() ? $exception->getCode() : HttpStatus::SERVER_ERROR))->handler();