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

@ -1524,7 +1524,7 @@ class Context
* @param string $message
* @return void
*/
public static function displayErrorPage($title = 'Error', $message = '', $status = 500)
public static function displayErrorPage($title = 'Error', $message = '', $status = 500, $location = '')
{
// Change current directory to the Rhymix installation path.
chdir(\RX_BASEDIR);
@ -1541,6 +1541,18 @@ class Context
$oMessageObject->setHttpStatusCode($status);
}
// Find out the caller's location.
if (!$location)
{
$backtrace = debug_backtrace(false);
$caller = array_shift($backtrace);
$location = $caller['file'] . ':' . $caller['line'];
if (starts_with(\RX_BASEDIR, $location))
{
$location = substr($location, strlen(\RX_BASEDIR));
}
}
if (in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON', 'JS_CALLBACK')))
{
$oMessageObject->setMessage(trim($title . "\n\n" . $message));
@ -1548,7 +1560,7 @@ class Context
else
{
$oMessageObject->setMessage($title);
$oMessageObject->dispMessage($message);
$oMessageObject->dispMessage($message, $location);
}
// Display the message.