Created
November 11, 2019 11:24
-
-
Save vilusa/c674563232cd5b2ec3b609220f4709e3 to your computer and use it in GitHub Desktop.
Error Service
This file contains hidden or 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
# frozen_string_literal: true | |
module ErrorService | |
class << self | |
def notify(notify) | |
notify = notify.red unless Rails.env.production? | |
Rails.logger.error(notify) | |
Rollbar.error(notify) | |
false | |
end | |
def exception(notify, exception) | |
message = "#{notify}. #{exception}" | |
message = message.red unless Rails.env.production? | |
Rails.logger.error(message) | |
Rails.logger.error(exception.backtrace.join("\n")) | |
Rollbar.error(notify) | |
false | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment