Exception: ShEx::ParseError

Inherits:
Error
  • Object
show all
Defined in:
lib/shex.rb

Overview

Indicates bad syntax found in LD Patch document

Instance Attribute Summary collapse

Attributes inherited from Error

#code

Instance Method Summary collapse

Constructor Details

#initialize(message, options = {}) ⇒ ParseError

Initializes a new parser error instance.

Parameters:

  • message (String, #to_s)
  • options (Hash{Symbol => Object}) (defaults to: {})

Options Hash (options):

  • :token (String) — default: nil
  • :lineno (Integer) — default: nil
  • :code (Integer) — default: 400


127
128
129
130
131
# File 'lib/shex.rb', line 127

def initialize(message, options = {})
  @token      = options[:token]
  @lineno     = options[:lineno] || (@token.lineno if @token.respond_to?(:lineno))
  super(message.to_s, code: options.fetch(:code, 400))
end

Instance Attribute Details

#linenoInteger (readonly)

The line number where the error occurred.

Returns:

  • (Integer)


117
118
119
# File 'lib/shex.rb', line 117

def lineno
  @lineno
end

#tokenString (readonly)

The invalid token which triggered the error.

Returns:

  • (String)


111
112
113
# File 'lib/shex.rb', line 111

def token
  @token
end