Exception: Ibex::Runtime::ResourceLimitError

Inherits:
ParseError
  • Object
show all
Defined in:
lib/ibex/runtime/parser.rb,
sig/ibex/runtime/parser.rbs

Overview

Raised when a configured parser-session resource budget is exhausted.

Instance Attribute Summary collapse

Attributes inherited from ParseError

#error_id, #expected_tokens, #location, #state, #suggestions, #token_id, #token_name, #token_value

Instance Method Summary collapse

Methods inherited from ParseError

#diagnostic_message, #location_label, #location_value

Constructor Details

#initialize(resource:, limit:, observed:, state:, location:) ⇒ ResourceLimitError

Returns a new instance of ResourceLimitError.

RBS:

  • (resource: Symbol, limit: Integer, observed: Integer, state: Integer?, location: untyped) -> void

Parameters:

  • resource: (Symbol)
  • limit: (Integer)
  • observed: (Integer)
  • state: (Integer, nil)
  • location: (Object)


92
93
94
95
96
97
98
99
100
# File 'lib/ibex/runtime/parser.rb', line 92

def initialize(resource:, limit:, observed:, state:, location:)
  @resource = resource
  @limit = limit
  @observed = observed
  super(
    "parser resource limit exceeded: #{resource} is #{observed}, configured maximum is #{limit}",
    state: state, location: location
  )
end

Instance Attribute Details

#limitInteger (readonly)

Signature:

  • Integer

Returns:

  • (Integer)


88
89
90
# File 'lib/ibex/runtime/parser.rb', line 88

def limit
  @limit
end

#observedInteger (readonly)

Signature:

  • Integer

Returns:

  • (Integer)


89
90
91
# File 'lib/ibex/runtime/parser.rb', line 89

def observed
  @observed
end

#resourceSymbol (readonly)

Signature:

  • Symbol

Returns:

  • (Symbol)


87
88
89
# File 'lib/ibex/runtime/parser.rb', line 87

def resource
  @resource
end

Instance Method Details

#to_hHash[Symbol, untyped]

RBS:

  • () -> Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


103
104
105
106
107
108
# File 'lib/ibex/runtime/parser.rb', line 103

def to_h
  {
    type: :resource_limit, resource: @resource, limit: @limit, observed: @observed,
    state: state, location: location
  }.freeze
end