Exception: Kerbi::EntryValidationError
- Defined in:
- lib/main/errors.rb
Constant Summary collapse
- MSG =
"Cannot write state because of validation errors: "
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(errors) ⇒ EntryValidationError
constructor
A new instance of EntryValidationError.
Constructor Details
#initialize(errors) ⇒ EntryValidationError
Returns a new instance of EntryValidationError.
91 92 93 94 |
# File 'lib/main/errors.rb', line 91 def initialize(errors) = self.class.(errors) super() end |
Class Method Details
.build_message(errors) ⇒ Object
109 110 111 112 |
# File 'lib/main/errors.rb', line 109 def self.(errors) parts = errors.map { |h| entry_line(h[0], h[1]) } "#{MSG} \n#{parts.join("\n")}" end |
.entry_line(tag, error_dicts) ⇒ Object
103 104 105 106 |
# File 'lib/main/errors.rb', line 103 def self.entry_line(tag, error_dicts) per_tag_parts = error_dicts.map{ |d| error_line(d) } "Entry['#{tag}'] \n #{per_tag_parts.join("\n")}".indent(1) end |
.error_line(error) ⇒ Object
97 98 99 |
# File 'lib/main/errors.rb', line 97 def self.error_line(error) "#{error[:attr]}['#{error[:value]}']: #{error[:msg]}".indent(1) end |