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");
|
set_error_handler("\\sammo\\logErrorByCustomHandler");
|
||||||
|
|
||||||
|
|
||||||
function logExceptionByCustomHandler(\Throwable $e)
|
function logExceptionByCustomHandler(\Throwable $e, bool $withDie = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
logError(
|
logError(
|
||||||
@@ -149,9 +149,12 @@ function logExceptionByCustomHandler(\Throwable $e)
|
|||||||
getExceptionTraceAsString($e)
|
getExceptionTraceAsString($e)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if($withDie){
|
||||||
echo $e->getTraceAsString();
|
echo $e->getTraceAsString();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
|
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
|
||||||
|
|
||||||
function checkForFatal()
|
function checkForFatal()
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class APIHelper
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Json::dieWithReason($e->getMessage());
|
Json::dieWithReason($e->getMessage());
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
logExceptionByCustomHandler($e);
|
logExceptionByCustomHandler($e, false);
|
||||||
Json::dieWithReason($e->getMessage());
|
Json::dieWithReason($e->getMessage());
|
||||||
} catch (mixed $e) {
|
} catch (mixed $e) {
|
||||||
Json::dieWithReason(strval($e));
|
Json::dieWithReason(strval($e));
|
||||||
|
|||||||
Reference in New Issue
Block a user