Exception: AdvancedSearch::SExp::InvalidType

Inherits:
Error
  • Object
show all
Defined in:
lib/advanced_search/sexp/invalid_type.rb

Overview

A nicer presentation of a ‘NameError`.

Instance Method Summary collapse

Constructor Details

#initialize(type, name_error) ⇒ InvalidType

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of InvalidType.



10
11
12
13
# File 'lib/advanced_search/sexp/invalid_type.rb', line 10

def initialize(type, name_error)
  @type = type
  @name_error = name_error
end

Instance Method Details

#messageObject

Returns String.

Returns:

  • String



17
18
19
20
21
22
23
24
# File 'lib/advanced_search/sexp/invalid_type.rb', line 17

def message
  format(
    'Invalid S-expression type: %s (%s) Valid types are: %s',
    @type,
    @name_error.message,
    valid_types.join(', ')
  )
end