Exception: Procore::OAuthError

Inherits:
Error
  • Object
show all
Defined in:
lib/procore/errors.rb

Overview

Raised whenever there is a problem with OAuth. Possible causes: required credentials are missing or an access token failed to refresh.

Instance Attribute Summary

Attributes inherited from Error

#message, #response

Instance Method Summary collapse

Constructor Details

#initialize(message, response: nil) ⇒ OAuthError

Returns a new instance of OAuthError.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/procore/errors.rb', line 40

def initialize(message, response: nil)
  @message = message

  duck_response = if response
                    OpenStruct.new(
                      code: response.status,
                      body: response.parsed.presence || response.body,
                      headers: response.headers,
                      request: OpenStruct.new(
                        options: {},
                        path: nil,
                      ),
                    )
                  end

  super(message, response: duck_response)
end