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

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Sep 28 15:20:25 CEST 2009


Rupert Germann schrieb:
> Dmitry Dulepov schrieb:
>> Hi!
>>
>> Ernesto Baschny [cron IT] wrote:
>>> I think this is not correct. The exception handling of TYPO3 should
>>> provide the proper base classes for future use.
>>
>> +1 to this, -1 to removal of those classes.
> 
> ok, but then we should do it right.
> 
> 1. the error and warning exceptions (class.t3lib_error_warning.php,
> class.t3lib_error_error.php) should be actually used by the php
> error_handler (like it is done in Flow3 trunk)

This was done before (as it was an auto-backport from FLOW), you changed
it in your v7 (it was "throw new t3lib_error_Exception", and you changed
it to "throw new Exception").

I don't see FLOW3's php error_handler using Error/Warning and
Error/Error, as it throws "\F3\FLOW3\Error\Exception", as we had it in
the backported version.

> 2. instead of filling up t3lib/ with exception classes we should either
> create a subdir "exception" (like it is done in t3lib/cache/). Or we
> should collect them at a central point. e.g. in the error/ directory.

t3lib_exception is the only class there will be in t3lib, as it is the
"root exception class". More specific subclasses should go where they
are being used, e.g. t3lib_error_exception for the PHP error-exception
(t3lib/error/class.t3lib_error_exception.php). Generic TYPO3 exceptions
will probably be called t3lib_exception_xxx, going into
t3lib/exception/class.t3lib_exception_xxx.php. We don't have any of them
yet.

> 3. we should provide some examples in the core for usind the specialiced
> exceptions, e.g. by replacing the die() calls in t3lib_db by proper
> t3lib_db_exceptions (-> follow-up).

Yes, later we will get rid of all "die()" in core, but let's not
overcrowd this RFC with other stuff that might get commited separately.

> Dmitry and Ernesto, if we agree on this I'll prepare a new patch.

Agreed.

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list