Because the conditional on this line checks for strictly less than instead of less than or equal to, error blocks are unable to catch any thing which is a direct descendant of Exception.
|
return false unless key.respond_to? :superclass and key.superclass < Exception |
Here's a quick (untested) example:
require 'sinatra'
error do
puts "Error block called!"
end
get "/" do
raise StandardError
end
After visiting /, the error block will not be called. If this is by design, then this seems like a strange design decision. If it isn't, then I'd be happy to open a PR for this.