[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 10:19:04 CEST 2009


Rupert Germann schrieb:

>>> - removed the following files as they are not used/needed:
>>> class.t3lib_exception.php
>>> class.t3lib_error_error.php
>>> class.t3lib_error_exception.php
>>> class.t3lib_error_warning.php
>>
>> I think this is not correct. The exception handling of TYPO3 should
>> provide the proper base classes for future use.
> 
> I don't get the point currently. Can you give an example how this would
> look?
> 
>  > t3lib_error_error and t3lib_error_warning are probably there so that
>> other user-defined exceptions can subclass this. I wonder why these
>> don't subclass t3lib_exception? Using them, later the warnings
>> exceptions that "noone" catched could go to a log file, error-exceptions
>> go to the admin mail, etc.
> 
> I'm quite shure that in the current state they are useless.

As soon as we start adding exceptions being thrown by the core in
certain situations we will start having our own exception-classes for
certain situations. E.g. dberror_exception or 404_exception. We will
need a base-class for this, to be able to differenciate our own
exceptions and others (e.g. SPL exceptions).

If your app only "throw Exception" there is no way for the core (or the
exception handler) to know if this is coming from a TYPO3 API-conforming
extension or from some third party extension that is embedded in TYPO3.

So I would like to at least have a base-class (t3lib_Exception) in our
core for all future exceptions to be produced in extensions. The first
usage of this is the PHP error exception, which also gives the right for
t3lib_error_Exception (thrown in t3lib_error_ErrorHandler).

This would mean in my eyes we currently only don't need
t3lib_error_Error and t3lib_error_Warning except if we want to make use
of them in the same fashion as FLOW3 does.

Maybe Karsten or someone from the FLOW3 team could enlighten us a bit on
the plans of FLOW3 to make use of the base-class, as I also see lots of
SPL-exceptions being thrown in FLOW3 (e.g. InvalidArgumentException).

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list