Exception: Foobara::CommandConnector::NotAllowedError

Inherits:
CommandConnectorError show all
Defined in:
foobara-0.0.110/projects/command_connectors/src/command_connector/not_allowed_error.rb

Instance Attribute Summary

Attributes inherited from Error

#backtrace_when_initialized, #backtrace_when_raised, #context, #error_key, #is_fatal, #message

Class Method Summary collapse

Methods inherited from CommandConnectorError

#initialize

Methods inherited from RuntimeError

category, fatal?, #initialize

Methods inherited from Error

#==, abstract, abstract?, category, context, #eql?, fatal?, #fatal?, foobara_manifest, #initialize, #key, message, path, #prepend_path!, runtime_path, subclass, symbol, to_h, #to_h, types_depended_on

Methods included from Foobara::Concern

foobara_class_methods_module_for, foobara_concern?, included

Constructor Details

This class inherits a constructor from Foobara::CommandConnector::CommandConnectorError

Class Method Details

.for(rule_symbol: nil, explanation: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'foobara-0.0.110/projects/command_connectors/src/command_connector/not_allowed_error.rb', line 5

def for(rule_symbol: nil, explanation: nil)
  rule_symbol ||= :no_symbol_declared
  message = "Not allowed"
  if explanation
    message += ": #{explanation}"
  end
  explanation ||= "No explanation"
  context = { rule_symbol:, explanation: }

  new(message:, context:)
end