fix: logExceptionByCustomHandler에서 echo 안하는 옵션 추가
This commit is contained in:
+7
-4
@@ -96,7 +96,7 @@ function logError(string $err, string $errstr, string $errpath, array $trace)
|
|||||||
$fdb = FileDB::db(ROOT . '/d_log/err_log.sqlite3', ROOT . '/f_install/sql/err_log.sql');
|
$fdb = FileDB::db(ROOT . '/d_log/err_log.sqlite3', ROOT . '/f_install/sql/err_log.sql');
|
||||||
$date = date("Ymd_His");
|
$date = date("Ymd_His");
|
||||||
|
|
||||||
$err = str_replace(ROOT, '{ROOT}', $errpath);
|
$err =str_replace(ROOT, '{ROOT}', $errpath);
|
||||||
$errpath = str_replace(ROOT, '{ROOT}', $errpath);
|
$errpath = str_replace(ROOT, '{ROOT}', $errpath);
|
||||||
$trace = array_map(function (string $text) {
|
$trace = array_map(function (string $text) {
|
||||||
return str_replace(ROOT, '{ROOT}', $text);
|
return str_replace(ROOT, '{ROOT}', $text);
|
||||||
@@ -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,8 +149,11 @@ function logExceptionByCustomHandler(\Throwable $e)
|
|||||||
getExceptionTraceAsString($e)
|
getExceptionTraceAsString($e)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo $e->getTraceAsString();
|
if($withDie){
|
||||||
throw $e;
|
echo $e->getTraceAsString();
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
|
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
|
||||||
|
|
||||||
|
|||||||
@@ -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