44
55use Error ;
66use ErrorException ;
7+ use ErrorHeroModule \HeroConstant ;
78use Exception ;
89use Psr \Http \Message \ServerRequestInterface ;
910use RuntimeException ;
@@ -185,11 +186,12 @@ private function collectExceptionData($e)
185186 {
186187 $ priority = Logger::ERR ;
187188 if ($ e instanceof ErrorException && isset (Logger::$ errorPriorityMap [$ e ->getSeverity ()])) {
188- $ priority = Logger::$ errorPriorityMap [$ e ->getSeverity ()];
189+ $ priority = Logger::$ errorPriorityMap [$ e ->getSeverity ()];
190+ $ errorType = HeroConstant::ERROR_TYPE [$ e ->getSeverity ()];
191+ } else {
192+ $ errorType = get_class ($ e );
189193 }
190194
191- $ exceptionClass = get_class ($ e );
192-
193195 $ errorFile = $ e ->getFile ();
194196 $ errorLine = $ e ->getLine ();
195197 $ trace = $ e ->getTraceAsString ();
@@ -202,7 +204,7 @@ private function collectExceptionData($e)
202204
203205 return [
204206 'priority ' => $ priority ,
205- 'exceptionClass ' => $ exceptionClass ,
207+ 'errorType ' => $ errorType ,
206208 'errorFile ' => $ errorFile ,
207209 'errorLine ' => $ errorLine ,
208210 'trace ' => $ trace ,
@@ -221,7 +223,7 @@ private function collectExceptionExtraData(array $collectedExceptionData)
221223 'url ' => $ this ->serverUrl .$ this ->requestUri ,
222224 'file ' => $ collectedExceptionData ['errorFile ' ],
223225 'line ' => $ collectedExceptionData ['errorLine ' ],
224- 'error_type ' => $ collectedExceptionData ['exceptionClass ' ],
226+ 'error_type ' => $ collectedExceptionData ['errorType ' ],
225227 'trace ' => $ collectedExceptionData ['trace ' ],
226228 'request_data ' => $ this ->getRequestData (),
227229 ];
@@ -291,7 +293,7 @@ public function handleException($e)
291293 $ extra = $ this ->collectExceptionExtraData ($ collectedExceptionData );
292294 }
293295
294- $ this ->sendMail ($ collectedExceptionData ['priority ' ], $ collectedExceptionData ['errorMessage ' ], $ extra , '[ ' .$ this ->serverUrl .'] ' .$ collectedExceptionData ['exceptionClass ' ].' has thrown ' );
296+ $ this ->sendMail ($ collectedExceptionData ['priority ' ], $ collectedExceptionData ['errorMessage ' ], $ extra , '[ ' .$ this ->serverUrl .'] ' .$ collectedExceptionData ['errorType ' ].' has thrown ' );
295297 }
296298
297299 /**
0 commit comments