class Sinatra::Base

def dispatch!

Dispatch a request with error handling.
def dispatch!
  static! if settings.static? && (request.get? || request.head?)
  filter! :before
  route!
rescue NotFound => boom
  handle_not_found!(boom)
rescue ::Exception => boom
  handle_exception!(boom)
ensure
  filter! :after unless env['sinatra.static_file']
end