Class: Lutaml::Xsd::Errors::Troubleshooters::NamespaceTroubleshooter

Inherits:
TroubleshootingHandler show all
Defined in:
lib/lutaml/xsd/errors/troubleshooters/namespace_troubleshooter.rb

Overview

Troubleshooter for namespace-related errors

Provides tips for resolving namespace issues

Examples:

Using the troubleshooter

class NamespaceError < EnhancedError
  use_troubleshooter NamespaceTroubleshooter
end

error = NamespaceError.new(
  "Namespace prefix 'gml' not found",
  context: {
    namespace: "http://www.opengis.net/gml/3.2",
    actual_value: "gml:CodeType"
  }
)
error.troubleshooting_tips # => ["Check if namespace prefix...", ...]

Instance Method Summary collapse

Methods inherited from TroubleshootingHandler

#generate_tips

Instance Method Details

#tips_for(error) ⇒ Array<String>

Generate namespace troubleshooting tips

Parameters:

Returns:

  • (Array<String>)

    Troubleshooting tips



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/lutaml/xsd/errors/troubleshooters/namespace_troubleshooter.rb', line 31

def tips_for(error)
  return [] unless can_troubleshoot?(error)

  tips = []
  context = context_from(error)

  tips.concat(namespace_uri_tips(context)) if context.namespace

  tips.concat(namespace_prefix_tips(context)) if context.actual_value&.include?(":")

  tips.concat(general_namespace_tips)
  tips
end