Skip to content

Commit

Permalink
ignore AR not found errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jkraemer committed Feb 8, 2012
1 parent 61e8aca commit 0c8f6b2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/controllers/notices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class NoticesController < ActionController::Base
/^\d+:/
]

# error classes to ignore
EXCEPTION_FILTERS = [
/ActiveRecord::RecordNotFound/
]

def index_v2
logger.debug {"received v2 request:\n#{@notice.inspect}\nwith redmine_params:\n#{@redmine_params.inspect}"}
create_or_update_issue @redmine_params, @notice
Expand All @@ -34,6 +39,9 @@ def create_or_update_issue(redmine_params, notice)

# error class and message
error_class = notice['error']['class']
if EXCEPTION_FILTERS.detect{|f| error_class.to_s =~ f}
render( :status => 200, :text => "Ignored bug report (filtered exception)." ) and return
end
error_message = notice['error']['message']

# build filtered backtrace
Expand Down Expand Up @@ -106,7 +114,7 @@ def create_or_update_issue(redmine_params, notice)
Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated')
end

render :status => 200, :text => "Received bug report.\n<error-id>#{issue.id}</error-id>"
render :status => 201, :text => "Received bug report.\n<error-id>#{issue.id}</error-id>"
end

def format_hash(hash)
Expand Down

0 comments on commit 0c8f6b2

Please sign in to comment.