Exception: Woods::MCP::ProviderUnreachable

Inherits:
Error
  • Object
show all
Defined in:
lib/woods/mcp/errors.rb

Overview

Raised when the configured embedding provider cannot be reached at boot. This is a recoverable sibling of BootstrapError — it is deliberately outside the BootstrapError hierarchy because the MCP server starts degraded and retries on first query rather than refusing to start.

Bootstrapper catches this internally; nothing upstream should rescue it.

Examples:

raise Woods::MCP::ProviderUnreachable.new(
  "http://host.docker.internal:11434 refused connection",
  details: { url: "http://host.docker.internal:11434", reason: "connection refused" }
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, url: nil, reason: nil, details: {}) ⇒ ProviderUnreachable

Supports two call styles:

Woods::MCP::ProviderUnreachable.new(url: "http://...", reason: "timeout")
Woods::MCP::ProviderUnreachable.new("message", details: { ... })

The kwarg form is preferred — probes have url/reason in hand and the message is derived. The positional form exists for callers that already have a formatted message.



115
116
117
118
119
120
121
122
# File 'lib/woods/mcp/errors.rb', line 115

def initialize(message = nil, url: nil, reason: nil, details: {})
  @url = url || details[:url] || details['url']
  @reason = reason || details[:reason] || details['reason']
  @details = details.dup
  @details[:url] = @url if @url && !@details.key?(:url) && !@details.key?('url')
  @details[:reason] = @reason if @reason && !@details.key?(:reason) && !@details.key?('reason')
  super(message || default_message)
end

Instance Attribute Details

#detailsHash (readonly)

Returns Structured context forwarded to operators for diagnosis.

Returns:

  • (Hash)

    Structured context forwarded to operators for diagnosis



105
106
107
# File 'lib/woods/mcp/errors.rb', line 105

def details
  @details
end

#reasonString (readonly)

Returns Machine-readable failure reason (e.g. “connection_refused”, “timeout”, “http_500”, “unauthorized”, “dns_failure”).

Returns:

  • (String)

    Machine-readable failure reason (e.g. “connection_refused”, “timeout”, “http_500”, “unauthorized”, “dns_failure”)



103
104
105
# File 'lib/woods/mcp/errors.rb', line 103

def reason
  @reason
end

#urlString (readonly)

Returns URL that was probed.

Returns:

  • (String)

    URL that was probed



100
101
102
# File 'lib/woods/mcp/errors.rb', line 100

def url
  @url
end