File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed
Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change 1111
1212abstract class ApiException extends Exception implements HttpExceptionInterface
1313{
14- // return api code, override if needed
14+ /**
15+ * return api code, override if needed.
16+ *
17+ * @var int
18+ */
1519 public const API_CODE = Response::HTTP_INTERNAL_SERVER_ERROR ;
1620
17- // return http code, override if needed
21+ /**
22+ * return http code, override if needed.
23+ *
24+ * @var int
25+ */
1826 public const HTTP_CODE = Response::HTTP_INTERNAL_SERVER_ERROR ;
1927
20- // return message, override if needed
28+ /**
29+ * return message, override if needed.
30+ *
31+ * @var string
32+ */
2133 public const API_MESSAGE = '' ;
2234
2335 /**
@@ -58,13 +70,19 @@ public function render(Request $request): JsonResponse
5870 {
5971 return ApiResponseBuilder::exceptionError (
6072 $ this ,
61- static :: API_CODE ,
62- static :: HTTP_CODE ,
73+ $ this -> getApiCode () ,
74+ $ this -> getStatusCode () ,
6375 $ this ->message ,
64- $ this ->data
76+ $ this ->data ,
77+ $ this ->getHeaders (),
6578 );
6679 }
6780
81+ public function getApiCode (): int
82+ {
83+ return static ::API_CODE ;
84+ }
85+
6886 public function getStatusCode (): int
6987 {
7088 return static ::HTTP_CODE ;
You can’t perform that action at this time.
0 commit comments