Exception: WorkOS::WorkOSError

Inherits:
StandardError
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/workos/errors.rb

Overview

Parent class for WorkOS related errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message: nil, http_status: nil, request_id: nil) ⇒ WorkOSError

Returns a new instance of WorkOSError.



20
21
22
23
24
# File 'lib/workos/errors.rb', line 20

def initialize(message: nil, http_status: nil, request_id: nil)
  @message = message
  @http_status = http_status
  @request_id = request_id
end

Instance Attribute Details

#http_statusObject (readonly)

Returns the value of attribute http_status.



10
11
12
# File 'lib/workos/errors.rb', line 10

def http_status
  @http_status
end

#request_idObject (readonly)

Returns the value of attribute request_id.



11
12
13
# File 'lib/workos/errors.rb', line 11

def request_id
  @request_id
end

Instance Method Details

#to_sObject



27
28
29
30
31
# File 'lib/workos/errors.rb', line 27

def to_s
  status_string = @http_status.nil? ? '' : "Status #{@http_status}, "
  id_string = @request_id.nil? ? '' : " - request ID: #{@request_id}"
  "#{status_string}#{@message}#{id_string}"
end