codeguy/Slim — pull request #387 by jcubic (2012-08-26 00:29:34+00:00)
Title: Handle object returned by route handlers as string and impove exceptions handling

Data returned by handlers added by Slim::error Slim::notFound and routes are processed as strings and append at the end for the body (because return is always after someone put echo in route handler).

Slim::error is now exception handler and accept Exception as argument (Forget to put that information into comements)

I removed Slim_Middleware_PrettyExceptions middleware put that code into a function (in exception.php maybe it need to be put elsewhere or change to a method in Slim class).

Exceptions are handled in this way
* if user don't define error handler via Slim::exception it will exceute defaultError or prettyException depending on config('debug')
* if user define handler it will overwrite this check.
Also exceptions from user exception handler are cached and the default handler is exectued (defaulError or prettyException).