fix: logExceptionByCustomHandler에서 echo 안하는 옵션 추가
This commit is contained in:
+4
-1
@@ -139,7 +139,7 @@ function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, in
|
||||
set_error_handler("\\sammo\\logErrorByCustomHandler");
|
||||
|
||||
|
||||
function logExceptionByCustomHandler(\Throwable $e)
|
||||
function logExceptionByCustomHandler(\Throwable $e, bool $withDie = true)
|
||||
{
|
||||
|
||||
logError(
|
||||
@@ -149,9 +149,12 @@ function logExceptionByCustomHandler(\Throwable $e)
|
||||
getExceptionTraceAsString($e)
|
||||
);
|
||||
|
||||
if($withDie){
|
||||
echo $e->getTraceAsString();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
|
||||
|
||||
function checkForFatal()
|
||||
|
||||
@@ -100,7 +100,7 @@ class APIHelper
|
||||
} catch (\Exception $e) {
|
||||
Json::dieWithReason($e->getMessage());
|
||||
} catch (\Throwable $e) {
|
||||
logExceptionByCustomHandler($e);
|
||||
logExceptionByCustomHandler($e, false);
|
||||
Json::dieWithReason($e->getMessage());
|
||||
} catch (mixed $e) {
|
||||
Json::dieWithReason(strval($e));
|
||||
|
||||
Reference in New Issue
Block a user