Exception: Textus::GuardFailed
- Defined in:
- lib/textus/errors.rb
Instance Attribute Summary
Attributes inherited from Error
#code, #details, #exit_code, #hint
Instance Method Summary collapse
-
#initialize(failed) ⇒ GuardFailed
constructor
A new instance of GuardFailed.
Methods inherited from Error
Constructor Details
#initialize(failed) ⇒ GuardFailed
Returns a new instance of GuardFailed.
190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/textus/errors.rb', line 190 def initialize(failed) # failed: [[predicate_name, reason], ...] rows = failed.map { |name, reason| { "predicate" => name, "reason" => reason } } names = failed.map(&:first) super( "guard_failed", "guard refused crossing: #{failed.map { |n, r| "#{n} (#{r})" }.join("; ")}", details: { "failed" => rows }, hint: "run 'textus policy explain <key> --output=json' to see the full guard; " \ "unmet: #{names.join(", ")}", ) end |