Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Proposed API for controller error reporting
class TestController < ApplicationController
report RuntimeError, :status => 411, :error_code => :oh_noes
report ArgumentError, :status => 407, :error_code => :eeep do |exception, report|
report[:nartiploom] = Time.now
report[:banditry] = exception.class.name
end
report IndexError, :status => 404
def index
case params[:boom]
when 'arg'
raise ArgumentError, 'arg'
when 'fish'
{}.fetch 5
else
raise 'oops'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.