Class: Lutaml::Xml::Schema::Xsd::Errors::MessageBuilder
- Inherits:
-
Object
- Object
- Lutaml::Xml::Schema::Xsd::Errors::MessageBuilder
- Defined in:
- lib/lutaml/xml/schema/xsd/errors/message_builder.rb
Overview
Builder for constructing detailed error messages
Instance Attribute Summary collapse
-
#error ⇒ EnhancedError
readonly
The error to build message for.
Instance Method Summary collapse
-
#build ⇒ String
Build complete error message.
-
#initialize(error) ⇒ MessageBuilder
constructor
Initialize message builder.
Constructor Details
#initialize(error) ⇒ MessageBuilder
Initialize message builder
20 21 22 |
# File 'lib/lutaml/xml/schema/xsd/errors/message_builder.rb', line 20 def initialize(error) @error = error end |
Instance Attribute Details
#error ⇒ EnhancedError (readonly)
Returns The error to build message for.
15 16 17 |
# File 'lib/lutaml/xml/schema/xsd/errors/message_builder.rb', line 15 def error @error end |
Instance Method Details
#build ⇒ String
Build complete error message
27 28 29 30 31 32 33 34 |
# File 'lib/lutaml/xml/schema/xsd/errors/message_builder.rb', line 27 def build parts = [] parts << header parts << context_details if @error.context && !@error.context.to_h.empty? parts << suggestions_section if @error.respond_to?(:suggestions) && @error.suggestions.any? parts << troubleshooting_section if @error.respond_to?(:troubleshooting_tips) && @error.troubleshooting_tips.any? parts.compact.join("\n\n") end |