[TYPO3-project-4-3] CGL Exceptions

Martin Kutschker masi-no at spam-typo3.org
Mon Sep 29 11:08:42 CEST 2008


Steffen Kamper schrieb:
> Hi,
> 
> i think we missed discussing about Exceptions at T3DD08, so maybe we can
> discuss it here.
> 
> What i want to clarify is
> * naming convention of exceptions
> * using error handlers for exception
> 
> Looking to trunk we already have several exceptions in core. Some
> general ones
> * throw new Exception() in t3lib_div, t3lib_lock
> some named ones
> * UnexpectedValueException(msg, number)
> * t3lib_cache_Exception
> * InvalidArgumentException
> * t3lib_cache_Exception_InvalidData
> * t3lib_cache_exception_InvalidCache
> * t3lib_cache_DuplicateIdentifier
> * t3lib_cache_Exception_NoSuchCache
> * t3lib_cache_exception_ClassAlreadyLoaded
> * JSMinException (in 3rd party jsmin)
> *

I'd prefer as little named ones as possible. A good message description
an id (code) and the stack trace is good enough. No need to create an
extra class for everything. eg IMHO t3lib_cache_Exception_InvalidData is
pointless, a general InvalidData is enough, though itÄs not quite clear
from the name *which* data are invalid.

> next: when defining exceptions we should use an error handler.

We should, but not only for exceptions.

> Where should this be, one central or extra ones for t3lib / tslib /
> backend etc. Anyway i would prefer to have the errorhandlers
> implemented, even if they are empty for the start.

You'll need different ones. If you want to catch errors and warnings you
want to have different output when you are in the FE, BE and CLI. You
don't want to have output when you're in an AJAX call or cron job but
may want to log the error.

Masi


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