Exception: Textus::GuardFailed
- Defined in:
- lib/textus/errors.rb
Instance Attribute Summary
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(failed) ⇒ GuardFailed
constructor
A new instance of GuardFailed.
Methods inherited from Error
#details, #exit_code, #hint, #to_envelope
Constructor Details
#initialize(failed) ⇒ GuardFailed
Returns a new instance of GuardFailed.
198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/textus/errors.rb', line 198 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 |