title: In Sinatra, is there a way to use my own error handler for some errors, and the default handler for all other errors?
body: <p>The problem is that the default handler is defined in <strong>Sinatra::ShowExceptions</strong>, which is controlled by the <strong>:raise_errors</strong> configuration setting, and this setting is all or nothing. If <strong>:raise_errors</strong> is off then the <strong>error</strong> method can be used in the Sinatra app, but it has to be used for all exceptions, and there is no access to the error handler defined in <strong>Sinatra::ShowExceptions</strong>. If it is on, then all exceptions get handled by the ShowExceptions middleware.</p>
  
  <p>The rationale for what I want to do is that, at least during development, I want "expected" errors to be handled in a user-friendly fashion and I want "unexpected" errors to be handled in a developer-friendly fashion.</p>
  
  <p>I'm guessing that the only way to do this is to define a rack middleware class that inherits from <strong>Sinatra::ShowExceptions</strong>, and which has some extra option in its <strong>use</strong> method to specify which classes of exceptions to handle or not handle.</p>
  
  <p>Is there any easier way that I am missing?</p>
  
  <p>(I'm using jruby, if that makes any difference.)</p>