class SynapseClient::Error

Attributes

code[R]
exception[R]
message[R]
request[R]
title[R]

Public Class Methods

new(exception, request) click to toggle source
# File lib/synapse_client/error.rb, line 11
def initialize(exception, request)
  @exception = exception
  @request   = request

  #
    begin
      @message = @exception["reason"] || @exception["message"]
      @title   = @exception["title"]
    rescue => e
      # FIXME
      # Rails.logger.error("Something went wrong with interacting with Synapse: #{ @exception.message }")
      return
    end

  #
    if @message.present? && @message.match(/error.*oauth.*authentication/i).present?
      refreshed_tokens = SynapseClient::RefreshedTokens.new({
          :old_access_token => @request.customer_access_token,
          :old_refresh_token => @request.customer_refresh_token
        })

      refreshed_tokens.refresh_old_tokens
    end

end

Public Instance Methods

msg() click to toggle source
# File lib/synapse_client/error.rb, line 37
def msg
  (title || message).to_s
end