Exception: Kontena::Errors::StandardErrorHash
- Inherits:
-
StandardError
- Object
- StandardError
- StandardError
- Kontena::Errors::StandardErrorHash
- Defined in:
- lib/kontena/errors.rb
Overview
The normal {foo: “invalid foo”} error response format used by the API
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Attributes inherited from StandardError
Instance Method Summary collapse
-
#errors_message(indent: "\t") ⇒ Object
Render as indented YAML.
-
#initialize(status, message, errors) ⇒ StandardErrorHash
constructor
A new instance of StandardErrorHash.
-
#message ⇒ Object
Render the full multi-line message including YAML-formatted errors.
Constructor Details
#initialize(status, message, errors) ⇒ StandardErrorHash
Returns a new instance of StandardErrorHash.
20 21 22 23 |
# File 'lib/kontena/errors.rb', line 20 def initialize(status, , errors) super(status, ) @errors = errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
17 18 19 |
# File 'lib/kontena/errors.rb', line 17 def errors @errors end |
Instance Method Details
#errors_message(indent: "\t") ⇒ Object
Render as indented YAML
26 27 28 29 |
# File 'lib/kontena/errors.rb', line 26 def (indent: "\t") require 'yaml' @errors.to_yaml.lines[1..-1].map{|line| "#{indent}#{line}" }.join end |
#message ⇒ Object
Render the full multi-line message including YAML-formatted errors
32 33 34 |
# File 'lib/kontena/errors.rb', line 32 def "#{super}:\n#{}" end |