Exception: Inquirex::Errors::UnsafeSourceError

Inherits:
DefinitionError show all
Defined in:
lib/inquirex/errors.rb

Overview

Raised when DSL source contains anything outside the flow-DSL allowlist, i.e. when it is not safe to eval. See Inquirex::SafeSource.

Subclasses DefinitionError on purpose: hosts that already rescue that class and render the message keep working, and a rejected payload reads as "invalid DSL" rather than as a crash.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(violations) ⇒ UnsafeSourceError

Returns a new instance of UnsafeSourceError.

Parameters:

  • violations (Array<String>, String)

    human-readable violation messages



46
47
48
49
# File 'lib/inquirex/errors.rb', line 46

def initialize(violations)
  @violations = Array(violations)
  super("DSL rejected: #{@violations.join("; ")}")
end

Instance Attribute Details

#violationsArray<String> (readonly)

Returns every violation found, most useful first.

Returns:

  • (Array<String>)

    every violation found, most useful first



43
44
45
# File 'lib/inquirex/errors.rb', line 43

def violations
  @violations
end