lib/workos/errors.rb in workos-4.1.0 vs lib/workos/errors.rb in workos-4.2.0
- old
+ new
@@ -1,31 +1,16 @@
# frozen_string_literal: true
-# typed: true
-
module WorkOS
# Parent class for WorkOS related errors
class WorkOSError < StandardError
- extend T::Sig
-
attr_reader :http_status
attr_reader :request_id
attr_reader :code
attr_reader :errors
# rubocop:disable Metrics/ParameterLists
- sig do
- params(
- message: T.nilable(String),
- error: T.nilable(String),
- error_description: T.nilable(String),
- http_status: T.nilable(Integer),
- request_id: T.nilable(String),
- code: T.nilable(String),
- errors: T.nilable(T::Array[T::Hash[T.untyped, T.untyped]]),
- ).void
- end
def initialize(
message: nil,
error: nil,
error_description: nil,
http_status: nil,
@@ -41,10 +26,9 @@
@code = code
@errors = errors
end
# rubocop:enable Metrics/ParameterLists
- sig { returns(String) }
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}"