errors

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ToolError

type ToolError struct {
	Operation    string                 `json:"operation"`
	Cause        error                  `json:"cause"`
	Suggestions  []string               `json:"suggestions"`
	IsRetryable  bool                   `json:"is_retryable"`
	Timestamp    time.Time              `json:"timestamp"`
	ErrorCode    string                 `json:"error_code"`
	Component    string                 `json:"component"`
	ResourceType string                 `json:"resource_type,omitempty"`
	ResourceName string                 `json:"resource_name,omitempty"`
	Context      map[string]interface{} `json:"context,omitempty"`
}

ToolError represents a structured error with context and recovery suggestions

func NewArgoError

func NewArgoError(operation string, cause error) *ToolError

NewArgoError creates an Argo-specific error

func NewCiliumError

func NewCiliumError(operation string, cause error) *ToolError

NewCiliumError creates a Cilium-specific error

func NewCommandError

func NewCommandError(command string, cause error) *ToolError

NewCommandError creates a command execution error

func NewHelmError

func NewHelmError(operation string, cause error) *ToolError

NewHelmError creates a Helm-specific error

func NewIstioError

func NewIstioError(operation string, cause error) *ToolError

NewIstioError creates an Istio-specific error

func NewKubernetesError

func NewKubernetesError(operation string, cause error) *ToolError

NewKubernetesError creates a Kubernetes-specific error

func NewPrometheusError

func NewPrometheusError(operation string, cause error) *ToolError

NewPrometheusError creates a Prometheus-specific error

func NewSecurityError

func NewSecurityError(operation string, cause error) *ToolError

NewSecurityError creates a security-related error

func NewTimeoutError

func NewTimeoutError(operation string, timeout time.Duration) *ToolError

NewTimeoutError creates a timeout error

func NewToolError

func NewToolError(component, operation string, cause error) *ToolError

NewToolError creates a new structured tool error

func NewValidationError

func NewValidationError(field, message string) *ToolError

NewValidationError creates a validation error

func (*ToolError) Error

func (e *ToolError) Error() string

Error implements the error interface

func (*ToolError) ToMCPResult

func (e *ToolError) ToMCPResult() *mcp.CallToolResult

ToMCPResult converts the error to an MCP result with rich context

func (*ToolError) WithContext

func (e *ToolError) WithContext(key string, value interface{}) *ToolError

WithContext adds contextual information to the error

func (*ToolError) WithErrorCode

func (e *ToolError) WithErrorCode(code string) *ToolError

WithErrorCode sets the error code

func (*ToolError) WithResource

func (e *ToolError) WithResource(resourceType, resourceName string) *ToolError

WithResource adds resource information to the error

func (*ToolError) WithRetryable

func (e *ToolError) WithRetryable(retryable bool) *ToolError

WithRetryable sets whether the error is retryable

func (*ToolError) WithSuggestions

func (e *ToolError) WithSuggestions(suggestions ...string) *ToolError

WithSuggestions adds recovery suggestions to the error

Jump to

Keyboard shortcuts

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