If I use:
Rails.error.handle do
my_possible_error_code
end
The possible error is swallowed and never raised.
If I use:
Rails.error.record do
my_possible_error_code
end
The possible error is always raised.
If I use:
Rails.error.unexpected("Unexpected error") do
my_possible_error_code
end
The error is swallowed in production but not in test/development. But the error is wrapped in a ActiveSupport::ErrorReporter::UnexpectedError and the original message is hidden, which makes the console/log output information useless.
Where is the sweet combination where?:
- The error is swallowed in production
- The error is raised in test/development
Or, what workaround I can do to have this behaviour?
config.consider_all_requests_localmight have something to do with it. I'd set it to false in development and see if the behavior matches what you see in PROD.if Rails.env.local?envmay be a solution, but I don't find any way to use this approach without generating super messy code. The wholeRails.erroris about to make error handling not add noise to your code