update: return TypeError exception with ApiResponseObject . #4

This commit is contained in:
weichien00
2021-07-03 02:38:52 +08:00
parent 56c42fe8f9
commit da4b6cd850
@@ -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();