Exception: Ibex::Runtime::ResourceLimitError

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

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

#location_label

Constructor Details

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

Returns a new instance of ResourceLimitError.



126
127
128
129
130
131
132
133
134
# File 'lib/ibex/runtime/parser.rb', line 126

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

#limitObject (readonly)

: Integer



122
123
124
# File 'lib/ibex/runtime/parser.rb', line 122

def limit
  @limit
end

#observedObject (readonly)

: Integer



123
124
125
# File 'lib/ibex/runtime/parser.rb', line 123

def observed
  @observed
end

#resourceObject (readonly)

: Symbol



121
122
123
# File 'lib/ibex/runtime/parser.rb', line 121

def resource
  @resource
end

Instance Method Details

#to_hObject



137
138
139
140
141
142
# File 'lib/ibex/runtime/parser.rb', line 137

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