Exception: NRSER::ValueError

Inherits:
StandardError
  • Object
show all
Includes:
NicerError
Defined in:
lib/nrser/errors/value_error.rb

Overview

Raised when there is a problem with a value that does not fall into one of the other built-in exception categories (non-exhaustive list):

  1. It’s the wrong type (TypeError)

  2. It’s an argument (ArgumentError)

It is encouraged to attach the invalid value as the ‘value:` keyword argument, which is then stored in NicerError#context hash and can be accessed via #value.

Direct Known Subclasses

AttrError

Constant Summary

Constants included from NicerError

NicerError::DEFAULT_COLUMN_WIDTH

Instance Method Summary collapse

Methods included from NicerError

#add_extended_message?, column_width, #context, #context_section, #default_message, #details, #details_section, #extended_message, #format_message, #format_message_segment, included, #to_s

Constructor Details

#initialize(*message, **kwds) ⇒ Object

Create a new NRSER::ValueError.

Parameters:

Options Hash (**kwds):

  • :value (Object)

    The problematic value.



# File 'lib/nrser/errors/value_error.rb', line 47

Instance Method Details

#valueObject

Get the value at the ‘:value` key in NicerError#context.

Returns:



44
# File 'lib/nrser/errors/value_error.rb', line 44

def_context_delegator keys: :value

#value?Boolean

‘true` if we have a `:value` key in the NicerError#context.

Returns:

  • (Boolean)


44
# File 'lib/nrser/errors/value_error.rb', line 44

def_context_delegator keys: :value