[TYPO3-core] RFC #9355: Add an error and exception handler (backported from FLOW3)

Oliver Hader oliver at typo3.org
Wed Sep 16 18:29:37 CEST 2009


Hi all,

Ingo Renner schrieb:
> Hi *,
> 
> This is an SVN patch request.
> 
> Type: feature
> 
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=9355
> 
> Branches: trunk
> 
> Problem:
> Although we we use exceptions now, we do not have an exception handler yet.
> 
> Solution:
> FLOW3 offers a quite nice exception handler that is easy to adopt for
> TYPO3 4.x. The attached patch introduces a backport of that error and
> exception handling system.
> 
> Notes, how it works:
> First, there is an error handler that transforms errors into exceptions
> Then there are two different exception handler, one for production, and
> one for debugging / development.
> The debug exception handler shows a nice backtrace of the exception. The
> production exception handler only displays a message that something went
> wrong. Both handlers provide a link to typo3.org to look up details on
> what went wrong.
> Whether the debug exception handler is chosen depends on your setting of
> SYS.displayErrors (set to "2" it will also show you the debug backtrace
> when coming from the devIPmask, but to nobody else).

Concerning the performance issues:
I agree with Rupert that it's not required to load the error-/exception
handler in any case. But if an error or exception occurs it should be
handled somehow.

Instead of calling inside an created object
| set_error_handler(array($this, 'handleError'));
we could use something like this from the outside
| set_error_handler('t3lib_error_ErrorHandler::handleErrorCallback');

The static function "handleErrorCallback" would then create itself to be
a real object and do proper error handling. Thus, the class file get
loaded and created only for the case when an error or exception occurs.

I attached a small example of how this could look like.

olly
-- 
Oliver Hader
TYPO3 Release Manager 4.3


More information about the TYPO3-team-core mailing list