Added optional error code parameter to response.
Syntax changes.
Refactored error logging and reporting.

It must be noted that when Slim 'debug' option is set the erros from the
server will not be channeld through a JSON response but shown as HTML
output!

Currently exception stacks are printed in the log as DEBUG messages while exception
error messages are printed in the log as ERROR.