Exception: Textus::WriteForbidden

Inherits:
Error
  • Object
show all
Defined in:
lib/textus/errors.rb

Instance Attribute Summary

Attributes inherited from Error

#code, #details, #exit_code, #hint

Instance Method Summary collapse

Methods inherited from Error

#to_envelope

Constructor Details

#initialize(k, z, writers: nil) ⇒ WriteForbidden

Returns a new instance of WriteForbidden.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/textus/errors.rb', line 93

def initialize(k, z, writers: nil)
  writers_str =
    if writers && !writers.empty?
      writers.join(", ")
    else
      "the role(s) listed in the manifest 'write_policy:'"
    end
  details = { "key" => k, "zone" => z }
  details["writers"] = writers if writers
  super(
    "write_forbidden",
    "zone '#{z}' is not agent-writable for key '#{k}'",
    details: details,
    hint: "this zone is writable by #{writers_str}; pass --as=<role>",
  )
end