Class: Lutaml::Xsd::Errors::MessageBuilder
- Inherits:
-
Object
- Object
- Lutaml::Xsd::Errors::MessageBuilder
- Defined in:
- lib/lutaml/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
18 19 20 |
# File 'lib/lutaml/xsd/errors/message_builder.rb', line 18 def initialize(error) @error = error end |
Instance Attribute Details
#error ⇒ EnhancedError (readonly)
Returns The error to build message for.
13 14 15 |
# File 'lib/lutaml/xsd/errors/message_builder.rb', line 13 def error @error end |
Instance Method Details
#build ⇒ String
Build complete error message
25 26 27 28 29 30 31 32 |
# File 'lib/lutaml/xsd/errors/message_builder.rb', line 25 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 |