Exception: Pikuri::Command::RefusedError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pikuri/command/refused_error.rb

Overview

Raised by Pikuri::Command::Registry#get for a command that exists on disk but cannot be run — it declares allowed-tools:, or its body carries a !cmd</code> directive.

Host-facing: it never reaches a tool, so the +"Error: …"+-string convention for model-visible failures does not apply. A REPL rescues it and prints {#message}; the command stays in {Registry#list} so a menu can still show it, greyed out or not.

begin
text = registry.expand(name, arguments: args)
rescue Pikuri::Command::RefusedError => e
puts "/#{name} is unavailable — #{e.message}"
next
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location, reason) ⇒ RefusedError

Returns a new instance of RefusedError.

Parameters:

  • location (String)

    path of the command file

  • reason (String)

    what the file did, phrased as the predicate of "this command …"



27
28
29
30
# File 'lib/pikuri/command/refused_error.rb', line 27

def initialize(location, reason)
  @location = location
  super("#{location}: #{reason}")
end

Instance Attribute Details

#locationString (readonly)

Returns path of the command file.

Returns:

  • (String)

    path of the command file



22
23
24
# File 'lib/pikuri/command/refused_error.rb', line 22

def location
  @location
end