Exception: WSDL::ResourceLimitError

Inherits:
FatalError show all
Defined in:
lib/wsdl/errors.rb

Overview

Raised when a resource limit is exceeded.

This error protects against denial-of-service attacks from malformed or malicious WSDL documents that could exhaust system resources.

Examples:

Catching resource limit errors

begin
  client = WSDL::Client.new('http://example.com/huge.wsdl')
rescue WSDL::ResourceLimitError => e
  puts "Limit exceeded: #{e.limit_name}"
  puts "Limit: #{e.limit_value}, Actual: #{e.actual_value}"
end

Handling specific limits

begin
  client = WSDL::Client.new(wsdl_url)
rescue WSDL::ResourceLimitError => e
  case e.limit_name
  when :max_document_size
    puts "Document too large"
  when :max_schemas
    puts "Too many schema imports"
  end
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, limit_name: nil, limit_value: nil, actual_value: nil) ⇒ ResourceLimitError

Creates a new ResourceLimitError.

Parameters:

  • message (String) (defaults to: nil)

    error message

  • limit_name (Symbol) (defaults to: nil)

    the name of the limit (e.g., :max_document_size)

  • limit_value (Integer) (defaults to: nil)

    the configured limit

  • actual_value (Integer) (defaults to: nil)

    the value that exceeded the limit



355
356
357
358
359
360
# File 'lib/wsdl/errors.rb', line 355

def initialize(message = nil, limit_name: nil, limit_value: nil, actual_value: nil)
  @limit_name = limit_name
  @limit_value = limit_value
  @actual_value = actual_value
  super(message)
end

Instance Attribute Details

#actual_valueInteger (readonly)

Returns the actual value that exceeded the limit.

Returns:

  • (Integer)

    the actual value that exceeded the limit



347
348
349
# File 'lib/wsdl/errors.rb', line 347

def actual_value
  @actual_value
end

#limit_nameSymbol (readonly)

Returns the name of the limit that was exceeded.

Returns:

  • (Symbol)

    the name of the limit that was exceeded



341
342
343
# File 'lib/wsdl/errors.rb', line 341

def limit_name
  @limit_name
end

#limit_valueInteger (readonly)

Returns the configured limit value.

Returns:

  • (Integer)

    the configured limit value



344
345
346
# File 'lib/wsdl/errors.rb', line 344

def limit_value
  @limit_value
end