codeguy/Slim — pull request #400 by chelmertz (2012-08-28 22:59:15+00:00)
Title: request: Send back exceptions in JSON if negotiated

This patch exposes the accept-header, of the environment, to the
request. If I ask for json (like popular js-frameworks do), let them
not have to get a styled and very hard to parse HTML exception in the
response, but rather a well formed json-string.

With sensible messages in uncaught exceptions (if that ever can be
considered sensible..), this method let's all calling javascript reach
the error message in response.message on their end.

Signed-off-by: Carl Helmertz