[TYPO3-project-4-3] improve the errorhandling

Rupert Germann rupi at gmx.li
Sat Oct 10 18:01:21 CEST 2009


hi,

as long no one tests it, I'll continue to pimp it ;-)

Here's v6 of the improved error and exception handling which I now dare 
to call it: "quite final".

changes:
- errors and exceptions are now written to the syslog table without 
having the need to have a logged in be-user (implemented an own 
writeSyslog() function).
- if there's no DB connection present the error and exceptionhandling 
tries to establish a connection to be able to write to sys_log or devlog

I found out that this is needed, during testing some CLI script issues 
with a broken caching framework configuration.
If the caching framework throws an exception this happen before a DB 
connection has been established and so there were no entries written to 
devlog or sys_log.

greets
rupert




Rupert Germann schrieb:
> hi again,
> 
> I simplified the patch and removed the "flashmessages to adminpanel" 
> functionality.
> 
> Changes:
> - Error messages are now redered to the adminpanel with 
> $TT->setTSlogMessage()
> - Errors and Exceptions are written to the sys_log table if a BE_USER 
> object is present
> 
> With this last change the improved error and exception handling can now 
> write its messages to all available logging systems in TYPO3.
> 
> And additionally PHP errors which are handled by the errorhandler and 
> which are not registered as exceptional errors will not break the output 
> anymore. They are displayed as flashmessages in BE and in the adminpanel 
> in FE.
> 
> see screenshots.
> 
> greets
> rupert
> 
> 
> 
> Rupert Germann schrieb:
>>> hi & rfc
>>>
>>> here's a new approach to make the errorhandling fit for final.
>>>
>>> features:
>>> - if display of errors is enabled and an error occurs this error is 
>>> displayed as flashmessage
>>> - BE error flashmessages are displayed by template.php
>>> - FE error flashmessages are displayed in the adminpanel (see 
>>> screenshot)
>>> - to distinguish between production- and debug-mode I introduced a 
>>> new constant ERRORHANDLER_MODE which depends on the configured 
>>> exceptionhandler
>>> - all calls to errorhandling or exceptionhandling are logged to syslog
>>> to enable the syslog, add this to your localconf.php:
>>> $TYPO3_CONF_VARS['SYS']['systemLog'] = 'error_log,,2';   
>>> $TYPO3_CONF_VARS['SYS']['systemLogLevel'] = 0;
>>>
>>> - I introduced a new TYPO3_CONF_VARS parameter:
>>> $TYPO3_CONF_VARS['SYS']['errorHandlerErrors']
>>>
>>> this parameter configures which errors reach the errorhandler.
>>>
>>> $TYPO3_CONF_VARS['SYS']['exceptionalErrors'] is still used, it 
>>> configures the errors which should be converted to an exception.
>>>
>>> So we have 2 kind of errors: errorhandler errors and exceptionsl errors.
>>>
>>> The default configuration looks like this:
>>>
>>> 'errorHandlerErrors'=> E_ALL ^ E_NOTICE,
>>> 'exceptionalErrors' => E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ 
>>> E_USER_NOTICE ^ E_USER_WARNING
>>>
>>> That means: everything but E_NOTICE reaches the errorhandler. But the 
>>> errorhandler function throws only an exception on exceptional errors 
>>> like e.g. E_RECOVERABLE_ERROR.
>>>
>>>
>>> INFO:
>>> this patch contains patch 12130 v5.
>>>
>>>
>>> greets
>>> rupert
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 



More information about the TYPO3-project-4-3 mailing list