errors

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package errors classifies mcpbench error categories so the aggregator can keep a per-category count without scattering type switches throughout.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJSONRPCError

func NewJSONRPCError(code int, msg string) error

NewJSONRPCError wraps a JSON-RPC code+message as a JSONRPCError.

Types

type Category

type Category string

Category identifies the kind of failure observed for a single request.

const (
	CategoryOK        Category = "ok"
	CategoryTimeout   Category = "timeout"
	CategoryJSONRPC   Category = "jsonrpc"
	CategoryTransport Category = "transport"
	CategoryTemplate  Category = "template"
	CategoryOther     Category = "other"
)

Stable set of error categories.

func AllCategories

func AllCategories() []Category

AllCategories returns all error-bearing categories (excluding ok).

func Classify

func Classify(err error) Category

Classify returns the Category an error belongs to. nil returns CategoryOK.

type JSONRPCError

type JSONRPCError interface {
	error
	// Code returns the JSON-RPC error code.
	RPCCode() int
}

JSONRPCError is the minimal interface the classifier needs from a JSON-RPC error value. Defined here to avoid an import cycle with internal/jsonrpc.

type TemplateError

type TemplateError struct{ Inner error }

TemplateError indicates rendering the tool-args template failed.

func (*TemplateError) Error

func (e *TemplateError) Error() string

func (*TemplateError) Unwrap

func (e *TemplateError) Unwrap() error

Unwrap allows errors.Is / errors.As.

type TimeoutError

type TimeoutError struct{ Inner error }

TimeoutError indicates the request was cancelled due to timeout.

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

func (*TimeoutError) Unwrap

func (e *TimeoutError) Unwrap() error

Unwrap allows errors.Is / errors.As.

type TransportError

type TransportError struct{ Inner error }

TransportError indicates a failure at the transport layer (subprocess died, connection refused, malformed JSON frame, etc.).

func (*TransportError) Error

func (e *TransportError) Error() string

func (*TransportError) Unwrap

func (e *TransportError) Unwrap() error

Unwrap allows errors.Is / errors.As.

Jump to

Keyboard shortcuts

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