Exception: MediaTypes::UnexpectedValidationResultError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/media_types/scheme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fixture_caller, error) ⇒ UnexpectedValidationResultError

Returns a new instance of UnexpectedValidationResultError.



36
37
38
39
# File 'lib/media_types/scheme.rb', line 36

def initialize(fixture_caller, error)
  self.fixture_caller = fixture_caller
  self.error = error
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



50
51
52
# File 'lib/media_types/scheme.rb', line 50

def error
  @error
end

#fixture_callerObject

Returns the value of attribute fixture_caller.



50
51
52
# File 'lib/media_types/scheme.rb', line 50

def fixture_caller
  @fixture_caller
end

Instance Method Details

#messageObject



41
42
43
44
45
46
47
48
# File 'lib/media_types/scheme.rb', line 41

def message
  format(
    '%<caller_path>s:%<caller_line>s -> %<error>s',
    caller_path: fixture_caller.path,
    caller_line: fixture_caller.lineno,
    error: error.is_a?(MediaTypes::Scheme::ValidationError) ? "#{error.class}:#{error.message}" : error
  )
end