class Sinatra::Base

def handle_exception!(boom)

Error handling during requests.
def handle_exception!(boom)
  @env['sinatra.error'] = boom
  status boom.respond_to?(:code) ? Integer(boom.code) : 500
  if server_error?
    dump_errors! boom if settings.dump_errors?
    raise boom if settings.show_exceptions? and settings.show_exceptions != :after_handler
  end
  if not_found?
    headers['X-Cascade'] = 'pass'
    body '<h1>Not Found</h1>'
  end
  res = error_block!(boom.class, boom) || error_block!(status, boom)
  return res if res or not server_error?
  raise boom if settings.raise_errors? or settings.show_exceptions?
  error_block! Exception, boom
end