errors

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MCPError

type MCPError struct {
	Operation  string // The operation that failed (e.g., "get_environment")
	Message    string // Human-readable error message
	Suggestion string // Optional suggestion for the user
	Cause      error  // The underlying error
	StatusCode int    // HTTP status code if applicable
}

MCPError represents an MCP-specific error with context and suggestions

func ConflictError

func ConflictError(operation, action, resourceType, resourceID, currentState string) *MCPError

ConflictError creates an error for state conflicts

func NetworkError

func NetworkError(operation string, cause error) *MCPError

NetworkError creates an error for network/connectivity issues

func NewMCPError

func NewMCPError(operation, message string, cause error) *MCPError

NewMCPError creates a new MCP error with context

func NotFoundError

func NotFoundError(operation, resourceType, resourceID string) *MCPError

NotFoundError creates an error for when a resource is not found

func ParseHTTPError

func ParseHTTPError(operation string, err error, resourceID string) *MCPError

ParseHTTPError converts HTTP errors into user-friendly MCP errors

func PermissionError

func PermissionError(operation, resourceType, resourceID string) *MCPError

PermissionError creates an error for permission/access issues

func ServerError

func ServerError(operation string, cause error) *MCPError

ServerError creates an error for server-side issues

func ValidationError

func ValidationError(operation, parameter, issue string) *MCPError

ValidationError creates an error for parameter validation failures

func (*MCPError) Error

func (e *MCPError) Error() string

func (*MCPError) ToJSONRPCCode

func (e *MCPError) ToJSONRPCCode() int

ToJSONRPCError converts an MCPError to appropriate JSON-RPC error code

func (*MCPError) Unwrap

func (e *MCPError) Unwrap() error

func (*MCPError) WithStatusCode

func (e *MCPError) WithStatusCode(code int) *MCPError

WithStatusCode adds an HTTP status code to the error

func (*MCPError) WithSuggestion

func (e *MCPError) WithSuggestion(suggestion string) *MCPError

WithSuggestion adds a suggestion to the error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL