diff --git a/f_config/config.php b/f_config/config.php index 6646a59f..99393641 100644 --- a/f_config/config.php +++ b/f_config/config.php @@ -49,7 +49,7 @@ function getFriendlyErrorType($type) return "{$type}"; } -function getExceptionTraceAsString(\Throwable $exception) +function getExceptionTraceAsString($exception) { //https://gist.github.com/abtris/1437966 $rtn = ""; @@ -117,7 +117,7 @@ function logError(string $err, string $errstr, string $errpath, array $trace) ]); } -function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline) +function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext=null) { if (!(error_reporting() & $errno)) { // This error code is not included in error_reporting, so let it fall @@ -172,17 +172,7 @@ function getAPIExecutorClass($path){ throw new \InvalidArgumentException("{$path}는 올바른 API 경로가 아님"); } -function checkForFatal() -{ - $error = error_get_last(); - if ( $error["type"] == E_ERROR ){ - logErrorByCustomHandler( $error["type"], $error["message"], $error["file"], $error["line"] ); - } -} - -register_shutdown_function("\\sammo\\checkForFatal" ); - function buildAPIExecutorClass($type, string $rootPath, array $args):\sammo\BaseAPI{ $class = getAPIExecutorClass($type); return new $class($rootPath, $args); -} +} \ No newline at end of file diff --git a/hwe/func_command.php b/hwe/func_command.php index 0c89fef4..d8b6ac8c 100644 --- a/hwe/func_command.php +++ b/hwe/func_command.php @@ -363,7 +363,7 @@ function setGeneralCommand(int $generalID, array $rawTurnList, string $command, 'target'=>'arg' ]; } - catch (\Throwable $e){ + catch (\Exception $e){ return [ 'result'=>false, 'reason'=>$e->getCode().$e->getMessage(), @@ -445,7 +445,7 @@ function setNationCommand(int $generalID, array $turnList, string $command, ?arr 'target'=>'arg' ]; } - catch (\Throwable $e){ + catch (\Exception $e){ return [ 'result'=>false, 'reason'=>$e->getCode().$e->getMessage(), diff --git a/hwe/j_msg_get_old.php b/hwe/j_msg_get_old.php index b7758e7c..ec332914 100644 --- a/hwe/j_msg_get_old.php +++ b/hwe/j_msg_get_old.php @@ -38,7 +38,7 @@ if(count($lastMsgGet) >= 10){ } array_shift($lastMsgGet); } - catch(\Throwable $e){ + catch(\Exception $e){ $lastMsgGet = []; } } diff --git a/hwe/j_msg_get_recent.php b/hwe/j_msg_get_recent.php index eb15ff6a..addfcc1e 100644 --- a/hwe/j_msg_get_recent.php +++ b/hwe/j_msg_get_recent.php @@ -24,7 +24,7 @@ if(count($lastMsgGet) >= 10){ } array_shift($lastMsgGet); } - catch(\Throwable $e){ + catch(\Exception $e){ $lastMsgGet = []; } } diff --git a/hwe/j_raise_event.php b/hwe/j_raise_event.php index 8dc95b67..cfa22499 100644 --- a/hwe/j_raise_event.php +++ b/hwe/j_raise_event.php @@ -35,7 +35,7 @@ if($eventArgsJson !== null){ $eventArgs[] = $eventNextArgs; } } - catch(\Throwable $e){ + catch(\Exception $e){ Json::die([ 'result'=>false, 'reason'=>'arg가 올바른 json이 아닙니다' diff --git a/hwe/sammo/Event/Action/FinishNationBetting.php b/hwe/sammo/Event/Action/FinishNationBetting.php index 581ec38f..214fee48 100644 --- a/hwe/sammo/Event/Action/FinishNationBetting.php +++ b/hwe/sammo/Event/Action/FinishNationBetting.php @@ -23,7 +23,7 @@ class FinishNationBetting extends \sammo\Event\Action try { $bettingHelper = new Betting($this->bettingID); - } catch (\Throwable $e) { + } catch (\Exception $e) { return [__CLASS__, false, $e->getMessage()]; } diff --git a/hwe/sammo/Scenario.php b/hwe/sammo/Scenario.php index 307ae5ae..48268e16 100644 --- a/hwe/sammo/Scenario.php +++ b/hwe/sammo/Scenario.php @@ -392,7 +392,7 @@ class Scenario{ $text = \file_get_contents(ServConfig::getSharedIconPath('../hook/list.json?1')); $storedIcons = Json::decode($text); } - catch(\Throwable $e){ + catch(\Exception $e){ $storedIcons = []; } diff --git a/hwe/sammo/Scenario/GeneralBuilder.php b/hwe/sammo/Scenario/GeneralBuilder.php index 461d786e..769eb354 100644 --- a/hwe/sammo/Scenario/GeneralBuilder.php +++ b/hwe/sammo/Scenario/GeneralBuilder.php @@ -134,7 +134,7 @@ class GeneralBuilder{ $this->specialDomestic = SpecialityHelper::getDomesticClassByName($special); $this->specialWar = GameConst::$defaultSpecialWar; } - catch (\Throwable $e){ + catch (\Exception $e){ $this->specialDomestic = GameConst::$defaultSpecialDomestic; $this->specialWar = SpecialityHelper::getWarClassByName($special); } @@ -540,7 +540,7 @@ class GeneralBuilder{ $text = \file_get_contents(\sammo\ServConfig::getSharedIconPath('../hook/list.json?1')); $storedIcons = \sammo\Json::decode($text); } - catch(\Throwable $e){ + catch(\Exception $e){ $storedIcons = []; } diff --git a/j_updateServer.php b/j_updateServer.php index a0563d5b..eedb8169 100644 --- a/j_updateServer.php +++ b/j_updateServer.php @@ -345,7 +345,7 @@ if ($server == $baseServerName) { $imgResult = false; $imgDetail = $pullResult['reason']; } - } catch (\Throwable $e) { + } catch (\Exception $e) { $imgResult = false; $imgDetail = $e->getMessage(); } diff --git a/src/sammo/APIHelper.php b/src/sammo/APIHelper.php index 0dcbc4b4..85991782 100644 --- a/src/sammo/APIHelper.php +++ b/src/sammo/APIHelper.php @@ -15,7 +15,7 @@ class APIHelper try { $rawInput = file_get_contents('php://input'); $input = Json::decode($rawInput); - } catch (\Throwable $e) { + } catch (\Exception $e) { Json::dieWithReason($e->getMessage()); $input = null; }