Project

General

Profile

Actions

Feature #20735

closed

Improve error handling for tslib_fe->printError and die()

Added by Jeff Segars over 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2009-07-07
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

Description

Currently, TYPO3 handles severe errors in two ways. In a frontend context, tslib_fe->printError() is used to show a nicely formatted error message to the user. The call to printError() is typically accompanied by a corresponding sysLog entry and a 404 or 503 header to let the browser know this was not the expected result [1]. In the backend context, a simple die() is used with no specific headers or sysLog entries [2].

I would propose a new printError() method that is valid in both a frontend and backend context (the current method is actually a wrapper for a method in t3lib_timetrack which makes no sense to me). In addition to the current HTML output, it should handle the sysLog entry, HTTP headers, and exit. It should also check for CLI mode and output a simple text message in this case rather than the full HTML.

[1] From tslib_fe->connectToDB()
$message = 'Cannot connect to the current database, "'.TYPO3_db.'"';
t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
header('HTTP/1.0 503 Service Temporarily Unavailable');
$this->printError($message, 'Database Error');
exit;

[2] from t3lib_extMgm::extPath()
if (!isset($TYPO3_LOADED_EXT[$key])) {
#debug(array(debug_backtrace()));
die('TYPO3 Fatal Error: Extension key "'.$key.'" was NOT loaded! (t3lib_extMgm::extPath)');
}

(issue imported from #M11501)


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #21168: Improve the error and exception handlingClosedRupert Germann2009-10-01

Actions
Related to TYPO3 Core - Bug #22420: Do not die, be the exception!ClosedSteffen Kamper2010-04-11

Actions
Actions #1

Updated by Jeff Segars over 14 years ago

This has been fixed by the error handler introduced in 4.3 and the removal of the die() messages in 4.4, both flagged as related issues to this one.

Actions

Also available in: Atom PDF