Exception: LD::Patch::ParseError

Inherits:
Error show all
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch.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:

Options Hash (**options):

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


73
74
75
76
77
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch.rb', line 73

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:



63
64
65
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch.rb', line 63

def lineno
  @lineno
end

#tokenString (readonly)

The invalid token which triggered the error.

Returns:



57
58
59
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch.rb', line 57

def token
  @token
end