Skip to content

Instantly share code, notes, and snippets.

@vilusa
Created November 11, 2019 11:24
Show Gist options
  • Save vilusa/c674563232cd5b2ec3b609220f4709e3 to your computer and use it in GitHub Desktop.
Save vilusa/c674563232cd5b2ec3b609220f4709e3 to your computer and use it in GitHub Desktop.
Error Service
# 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