-
-
Save greenbigfrog/89e2edffaed65d8b0b9ae064c1ee3ea3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ErrorCatcher | |
def call(payload, context) | |
yield | |
rescue ex | |
context[Discord::Client].create_message(payload.channel_id, "There was an unexpected error. This has been reported and should be resolved soon") unless ex == DB::PoolRetryAttemptsExceeded if payload.is_a?(Discord::Message) | |
puts ex.inspect_with_backtrace | |
# Truncate all payloads for now | |
Raven.capture(Exception.new("Exception while handling message #{payload.to_s[0..2000]}")) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment