Exception: Textus::ReadForbidden

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, readers: nil) ⇒ ReadForbidden

Returns a new instance of ReadForbidden.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/textus/errors.rb', line 112

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