404s can be processed using a method not_found, for example, for example:
not_found do
'Site does not exist.'
end
500s can be processed by calling the error method using a block, for example:
error do
"Application error. Pls try later."
end
Details of the error can be obtained through sinatra.errorin request.env, for example:
error do
'An error occured: ' + request.env['sinatra.error'].message
end
source
share