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: runtime_value) -> void

Parameters:

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


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

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)


96
97
98
# File 'lib/ibex/runtime/parser.rb', line 96

def limit
  @limit
end

#observedInteger (readonly)

Signature:

  • Integer

Returns:

  • (Integer)


97
98
99
# File 'lib/ibex/runtime/parser.rb', line 97

def observed
  @observed
end

#resourceSymbol (readonly)

Signature:

  • Symbol

Returns:

  • (Symbol)


95
96
97
# File 'lib/ibex/runtime/parser.rb', line 95

def resource
  @resource
end

Instance Method Details

#to_hHash[Symbol, runtime_value]

RBS:

  • () -> Hash[Symbol, runtime_value]

Returns:

  • (Hash[Symbol, runtime_value])


111
112
113
114
115
116
# File 'lib/ibex/runtime/parser.rb', line 111

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