I would like to define an error block (or something) that would return all exceptions formatted in JSON somehow plus returning the standard http code (e.g. 404 for not found, 303 for auth errors etc).
Something like:
error do
e = env['sinatra.error']
json :result => 'error', :message => e.message
end
Thanks!
This should work:
Test it with curl to see that it works.