Skip to content

Commit

Permalink
only rescue exceptions in production
Browse files Browse the repository at this point in the history
  • Loading branch information
enichols committed Mar 7, 2016
1 parent d1a2714 commit d5af171
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/cognition/matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ def attempt(msg)
run(msg)
end

def run(msg)
@response = action.call(msg, match_data)
rescue => e
@response = "'#{msg.command}' found, but raised #{e.inspect}"
if ENV and ENV["RAILS_ENV"] == "production"
def run(msg)
@response = action.call(msg, match_data)
rescue => e
@response = "'#{msg.command}' found, but raised #{e.inspect}"
end
else
def run(msg)
@response = action.call(msg, match_data)
end
end

def matches?(msg)
Expand Down

0 comments on commit d5af171

Please sign in to comment.