class Sinatra::Base

def error_block!(key, *block_params)

Find an custom error block for the key(s) specified.
def error_block!(key, *block_params)
  base = settings
  while base.respond_to?(:errors)
    next base = base.superclass unless args = base.errors[key]
    args += [block_params]
    return process_route(*args)
  end
  return false unless key.respond_to? :superclass and key.superclass < Exception
  error_block!(key.superclass, *block_params)
end