I’m having problem with redirecting on error in Sinatra modular app.
I’m deploying on Heroku and when there is an error, application dies.
I’d like it to catch this error, redirect to error page and operate normally.
I’ve set in my base class things as below:
set :raise_errors, false
and
error do
redirect to('/')
end
but when I raise error from within route block it just goes to standard Sinatra error page.
What I need to do to catch my errors and redirect?
You also need
Here’s a simple demo
Without
:show_exceptionsset/raise500and/divide-by-zeroreturn the generic Sinatra error page, but with it they redirect as you would expect.