fix: logExceptionByCustomHandler에서 echo 안하는 옵션 추가

This commit is contained in:
2022-05-09 22:31:14 +09:00
parent 717017fad5
commit cfcdc3149f
2 changed files with 8 additions and 5 deletions
+4 -1
View File
@@ -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()
+1 -1
View File
@@ -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));