Show where an Exception was thrown or error object was returned

- 관리자에게만 표시함
  - 오류 화면을 표시하는 방식에 따라서는 표시되지 않을 수 있음
  - 코어 내부에서 발생하는 오류는 표시되지 않을 수 있음
  - message 모듈 스킨에 의존함
This commit is contained in:
Kijin Sung 2020-03-19 00:58:30 +09:00
parent 9042e4110c
commit 339fd234a5
10 changed files with 81 additions and 10 deletions

View file

@ -44,6 +44,19 @@ class BaseObject
{
$this->setError($error);
$this->setMessage($message);
if ($error)
{
$backtrace = debug_backtrace(false);
$caller = array_shift($backtrace);
$nextcaller = array_shift($backtrace);
if ($nextcaller && $nextcaller['function'] === 'createObject')
{
$caller = $nextcaller;
}
$location = $caller['file'] . ':' . $caller['line'];
$this->add('rx_error_location', $location);
}
}
/**
@ -298,4 +311,4 @@ if (version_compare(PHP_VERSION, '7.2', '<'))
}
/* End of file Object.class.php */
/* Location: ./classes/object/Object.class.php */
/* Location: ./classes/object/Object.class.php */