Module: Anthropic::Models::ErrorObject

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/error_object.rb,
sig/anthropic/models/error_object.rbs

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, derefed_variants, dump, hash, inspect, to_sorbet_type, variants

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Class Method Details

.new(type:, **args) ⇒ Anthropic::Models::InvalidRequestError, ...

Creates a new instance of the variant class whose type matches the given value, passing the remaining arguments to its constructor.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/anthropic/models/error_object.rb', line 42

def self.new(type:, **args)
  case type.to_sym
  when :invalid_request_error
    Anthropic::InvalidRequestError.new(**args)
  when :authentication_error
    Anthropic::AuthenticationError.new(**args)
  when :billing_error
    Anthropic::BillingError.new(**args)
  when :permission_error
    Anthropic::PermissionError.new(**args)
  when :not_found_error
    Anthropic::NotFoundError.new(**args)
  when :rate_limit_error
    Anthropic::RateLimitError.new(**args)
  when :timeout_error
    Anthropic::GatewayTimeoutError.new(**args)
  when :api_error
    Anthropic::APIErrorObject.new(**args)
  when :overloaded_error
    Anthropic::OverloadedError.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

Instance Method Details

#self?.variants::Array[Anthropic::Models::error_object]

Returns:

  • (::Array[Anthropic::Models::error_object])


17
# File 'sig/anthropic/models/error_object.rbs', line 17

def self?.variants: -> ::Array[Anthropic::Models::error_object]