module Sinatra::Helpers

def error(code, body = nil)

Halt processing and return the error status provided.
def error(code, body = nil)
  if code.respond_to? :to_str
    body = code.to_str
    code = 500
  end
  response.body = body unless body.nil?
  halt code
end