class Sinatra::Base
def error(*codes, &block)
class, or an HTTP status code to specify which errors should be
Define a custom error handler. Optionally takes either an Exception
def error(*codes, &block) args = compile! "ERROR", /.*/, block codes = codes.flat_map(&method(:Array)) codes << Exception if codes.empty? codes << Sinatra::NotFound if codes.include?(404) codes.each { |c| (@errors[c] ||= []) << args } end