Class: Lutaml::Xml::Error::InvalidNamespaceError

Inherits:
XmlError show all
Defined in:
lib/lutaml/xml/error/invalid_namespace_error.rb

Overview

Raised when an invalid namespace class is provided

This error is raised when a namespace parameter is not a valid XmlNamespace class, :blank, or :inherit symbol.

Examples:

raise InvalidNamespaceError.new(expected: "XmlNamespace class", got: String)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected: nil, got: nil, message: nil) ⇒ InvalidNamespaceError

Create a new InvalidNamespaceError

Parameters:

  • expected (String) (defaults to: nil)

    description of expected value

  • got (Object) (defaults to: nil)

    the actual value received

  • message (String, nil) (defaults to: nil)

    custom error message



25
26
27
28
29
30
# File 'lib/lutaml/xml/error/invalid_namespace_error.rb', line 25

def initialize(expected: nil, got: nil, message: nil)
  @expected = expected
  @received = got

  super(message || default_message)
end

Instance Attribute Details

#expectedString (readonly)

Returns the expected namespace type.

Returns:

  • (String)

    the expected namespace type



15
16
17
# File 'lib/lutaml/xml/error/invalid_namespace_error.rb', line 15

def expected
  @expected
end

#receivedObject (readonly)

Returns the actual value received.

Returns:

  • (Object)

    the actual value received



18
19
20
# File 'lib/lutaml/xml/error/invalid_namespace_error.rb', line 18

def received
  @received
end