Exception: ConsoleAgent::SafetyError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/console_agent/safety_guards.rb

Overview

Raised by safety guards to block dangerous operations. Host apps should raise this error in their custom guards. ConsoleAgent will catch it and guide the user to use ‘d’ or /danger.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, guard: nil, blocked_key: nil) ⇒ SafetyError

Returns a new instance of SafetyError.



8
9
10
11
12
# File 'lib/console_agent/safety_guards.rb', line 8

def initialize(message, guard: nil, blocked_key: nil)
  super(message)
  @guard = guard
  @blocked_key = blocked_key
end

Instance Attribute Details

#blocked_keyObject (readonly)

Returns the value of attribute blocked_key.



6
7
8
# File 'lib/console_agent/safety_guards.rb', line 6

def blocked_key
  @blocked_key
end

#guardObject (readonly)

Returns the value of attribute guard.



6
7
8
# File 'lib/console_agent/safety_guards.rb', line 6

def guard
  @guard
end