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.



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

#limitObject (readonly)

: Integer



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

def limit
  @limit
end

#observedObject (readonly)

: Integer



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

def observed
  @observed
end

#resourceObject (readonly)

: Symbol



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

def resource
  @resource
end

Instance Method Details

#to_hObject



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