Exception: WorkOS::WorkOSError
- Inherits:
-
StandardError
- Object
- StandardError
- WorkOS::WorkOSError
- Defined in:
- lib/workos/errors.rb
Overview
Parent class for WorkOS related errors
Direct Known Subclasses
APIError, AuthenticationError, ForbiddenRequestError, InvalidRequestError, NotFoundError, RateLimitExceededError, SignatureVerificationError, TimeoutError, UnprocessableEntityError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#error_description ⇒ Object
readonly
Returns the value of attribute error_description.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#retry_after ⇒ Object
readonly
Returns the value of attribute retry_after.
Instance Method Summary collapse
-
#initialize(message: nil, error: nil, error_description: nil, http_status: nil, request_id: nil, code: nil, errors: nil, data: nil, retry_after: nil) ⇒ WorkOSError
constructor
rubocop:disable Metrics/ParameterLists.
-
#to_s ⇒ Object
rubocop:enable Metrics/ParameterLists.
Constructor Details
#initialize(message: nil, error: nil, error_description: nil, http_status: nil, request_id: nil, code: nil, errors: nil, data: nil, retry_after: nil) ⇒ WorkOSError
rubocop:disable Metrics/ParameterLists
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/workos/errors.rb', line 16 def initialize( message: nil, error: nil, error_description: nil, http_status: nil, request_id: nil, code: nil, errors: nil, data: nil, retry_after: nil ) @message = @error = error @error_description = error_description @http_status = http_status @request_id = request_id @code = code @errors = errors @data = data @retry_after = retry_after end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
8 9 10 |
# File 'lib/workos/errors.rb', line 8 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
12 13 14 |
# File 'lib/workos/errors.rb', line 12 def data @data end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
10 11 12 |
# File 'lib/workos/errors.rb', line 10 def error @error end |
#error_description ⇒ Object (readonly)
Returns the value of attribute error_description.
11 12 13 |
# File 'lib/workos/errors.rb', line 11 def error_description @error_description end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/workos/errors.rb', line 9 def errors @errors end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
6 7 8 |
# File 'lib/workos/errors.rb', line 6 def http_status @http_status end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
7 8 9 |
# File 'lib/workos/errors.rb', line 7 def request_id @request_id end |
#retry_after ⇒ Object (readonly)
Returns the value of attribute retry_after.
13 14 15 |
# File 'lib/workos/errors.rb', line 13 def retry_after @retry_after end |
Instance Method Details
#to_s ⇒ Object
rubocop:enable Metrics/ParameterLists
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/workos/errors.rb', line 39 def to_s status_string = @http_status.nil? ? '' : "Status #{@http_status}, " id_string = @request_id.nil? ? '' : " - request ID: #{@request_id}" if @error && @error_description error_string = "error: #{@error}, error_description: #{@error_description}" "#{status_string}#{error_string}#{id_string}" elsif @error "#{status_string}#{@error}#{id_string}" else "#{status_string}#{@message}#{id_string}" end end |