Class: Lutaml::Xsd::Errors::Troubleshooters::TroubleshootingHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/xsd/errors/troubleshooters/troubleshooting_handler.rb

Overview

Base class for troubleshooting handlers

Troubleshooting handlers provide actionable tips to help users resolve errors.

Examples:

Implementing a custom troubleshooter

class MyTroubleshooter < TroubleshootingHandler
  def tips_for(error)
    [
      "Check configuration",
      "Verify file paths"
    ]
  end
end

Registering a troubleshooter

MyError.use_troubleshooter(MyTroubleshooter)

Direct Known Subclasses

NamespaceTroubleshooter

Instance Method Summary collapse

Instance Method Details

#generate_tips(error) ⇒ Array<String>

Generate tips for the error

Alias for tips_for to support chain of responsibility pattern

Parameters:

Returns:

  • (Array<String>)

    Troubleshooting tips



40
41
42
# File 'lib/lutaml/xsd/errors/troubleshooters/troubleshooting_handler.rb', line 40

def generate_tips(error)
  tips_for(error)
end

#tips_for(error) ⇒ Array<String>

This method is abstract.

Subclasses must implement this method

Generate troubleshooting tips for the given error

Parameters:

Returns:

  • (Array<String>)

    List of troubleshooting tips

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/lutaml/xsd/errors/troubleshooters/troubleshooting_handler.rb', line 30

def tips_for(error)
  raise NotImplementedError, "#{self.class} must implement #tips_for"
end