I would like to raise an exception so that it does the same thing a normal Rails exception does. Specially, show the exception and stack trace in development mode and show “We’re sorry, but something went wrong” page in production mode.
I tried the following:
raise "safety_care group missing!" if group.nil?
But it simply writes "ERROR signing up, group missing!" to the development.log file
You don’t have to do anything special, it should just be working.
When I have a fresh rails app with this controller:
and go to
http://127.0.0.1:3000/foo/I am seeing the exception with a stack trace.
You might not see the whole stacktrace in the console log because Rails (since 2.3) filters lines from the stack trace that come from the framework itself.
See
config/initializers/backtrace_silencers.rbin your Rails project