errors

package
v0.0.0-...-0832d17 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(code Code, format string, args ...any) error

func FieldsOf

func FieldsOf(err error) map[string]any

func HTTPStatus

func HTTPStatus(err error) int

func HTTPStatusFromCode

func HTTPStatusFromCode(code Code) int

HTTPStatusFromCode maps a sigilerr Code string directly to an HTTP status code. This is the code-string counterpart of HTTPStatus(error) — useful when only a code string is available (e.g., parsed from an SSE error event payload).

The SSE handler acts as a proxy, so unknown/unclassified codes default to 502 Bad Gateway (rather than HTTPStatus's 500 Internal Server Error).

func HasCode

func HasCode(err error, code Code) bool

func IsBudgetExceeded

func IsBudgetExceeded(err error) bool

func IsConflict

func IsConflict(err error) bool

func IsInvalidInput

func IsInvalidInput(err error) bool

func IsLimitExceeded

func IsLimitExceeded(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsScannerCode

func IsScannerCode(err error) bool

IsScannerCode reports whether the error's code is any security.scanner.* code.

func IsTimeout

func IsTimeout(err error) bool

func IsUnauthorized

func IsUnauthorized(err error) bool

func IsUpstreamFailure

func IsUpstreamFailure(err error) bool

func Join

func Join(errs ...error) error

func New

func New(code Code, msg string, fields ...Attr) error

func With

func With(err error, fields ...Attr) error

With adds structured fields to an existing error chain.

func Wrap

func Wrap(err error, code Code, msg string, fields ...Attr) error

func Wrapf

func Wrapf(err error, code Code, format string, args ...any) error

Types

type Attr

type Attr struct {
	Key   string
	Value any
}

Attr is a structured key/value context attached to an error.

func Field

func Field(key string, value any) Attr

Field is kept as the primary helper for terse callsites.

func FieldPlugin

func FieldPlugin(value string) Attr

func FieldProvider

func FieldProvider(value string) Attr

func FieldSessionID

func FieldSessionID(value string) Attr

func FieldUserID

func FieldUserID(value string) Attr

func FieldValue

func FieldValue(key string, value any) Attr

FieldValue creates a structured error field.

func FieldWorkspaceID

func FieldWorkspaceID(value string) Attr

type Code

type Code string

Code is the machine-readable identifier for an error.

const (
	CodeStoreSessionGetNotFound     Code = "store.session.get.not_found"
	CodeStoreSessionUpdateConflict  Code = "store.session.update.conflict"
	CodeStoreEntityNotFound         Code = "store.entity.get.not_found"
	CodeStoreMessageAppendInvalid   Code = "store.message.append.invalid_input"
	CodeStoreKnowledgeQueryDatabase Code = "store.knowledge.query.database_failure"
	CodeStoreDatabaseFailure        Code = "store.database.failure"
	CodeStoreBackendUnsupported     Code = "store.backend.unsupported"
	CodeStoreConflict               Code = "store.conflict"
	CodeStoreInvalidInput           Code = "store.invalid_input"

	CodeConfigLoadReadFailure          Code = "config.load.read.failure"
	CodeConfigParseInvalidFormat       Code = "config.parse.invalid_format"
	CodeConfigValidateInvalidValue     Code = "config.validate.invalid_value"
	CodeConfigAlreadyExists            Code = "config.already_exists"
	CodeConfigKeyringResolutionFailure Code = "config.keyring.resolution.failure"

	CodePluginManifestValidateInvalid    Code = "plugin.manifest.validate.invalid"
	CodePluginCapabilityDenied           Code = "plugin.capability.denied"
	CodePluginRuntimeStartFailure        Code = "plugin.runtime.start.failure"
	CodePluginRuntimeCallFailure         Code = "plugin.runtime.call.failure"
	CodePluginLifecycleTransitionInvalid Code = "plugin.lifecycle.transition.invalid"
	CodePluginDiscoveryFailure           Code = "plugin.discovery.failure"
	CodePluginNotFound                   Code = "plugin.not_found"
	CodePluginChannelNotFound            Code = "plugin.channel.not_found"
	CodePluginSandboxPathInvalid         Code = "plugin.sandbox.path.invalid"
	CodePluginSandboxUnsupported         Code = "plugin.sandbox.unsupported"
	CodePluginSandboxSetupFailure        Code = "plugin.sandbox.setup.failure"
	CodePluginSandboxNetworkInvalid      Code = "plugin.sandbox.network.invalid"
	CodePluginRuntimeConfigInvalid       Code = "plugin.runtime.config.invalid"

	CodeProviderRequestInvalid  Code = "provider.request.invalid"
	CodeProviderResponseInvalid Code = "provider.response.invalid"
	CodeProviderUpstreamFailure Code = "provider.upstream.failure"
	CodeProviderBudgetExceeded  Code = "provider.budget.exceeded"
	CodeProviderNotFound        Code = "provider.registry.not_found"
	CodeProviderAllUnavailable  Code = "provider.routing.all_unavailable"
	CodeProviderNoDefault       Code = "provider.routing.no_default"
	CodeProviderInvalidModelRef Code = "provider.routing.invalid_model_ref"
	CodeProviderInvalidEvent    Code = "provider.event.invalid"
	CodeProviderKeyInvalid      Code = "provider.key.invalid"
	CodeProviderKeyCheckFailed  Code = "provider.key.check_failed"

	CodeAgentLoopInvalidInput        Code = "agent.loop.invalid_input"
	CodeAgentLoopFailure             Code = "agent.loop.failure"
	CodeAgentSessionBoundaryMismatch Code = "agent.session.boundary.forbidden"
	CodeAgentSessionInactive         Code = "agent.session.status.forbidden"
	CodeAgentToolBudgetExceeded      Code = "agent.tool.budget_exceeded"
	CodeAgentToolTimeout             Code = "agent.tool.timeout"
	CodeAgentSkillParseInvalid       Code = "agent.skill.parse.invalid"
	CodeAgentLoopPartialCommit       Code = "agent.loop.partial_commit"

	CodeWorkspaceOpenFailure      Code = "workspace.open.failure"
	CodeWorkspaceMembershipDenied Code = "workspace.membership.denied"
	CodeWorkspaceConfigInvalid    Code = "workspace.config.invalid"
	CodeWorkspaceCloseFailure     Code = "workspace.close.failure"

	CodeServerRequestInvalid   Code = "server.request.invalid"
	CodeServerAuthUnauthorized Code = "server.auth.unauthorized"
	CodeServerAuthForbidden    Code = "server.auth.forbidden"
	CodeServerInternalFailure  Code = "server.internal.failure"
	CodeServerEntityNotFound   Code = "server.entity.not_found"
	CodeServerConfigInvalid    Code = "server.config.invalid"
	CodeServerStartFailure     Code = "server.start.failure"
	CodeServerShutdownFailure  Code = "server.shutdown.failure"
	CodeServerNotImplemented   Code = "server.method.not_implemented"
	CodeServerRateLimited      Code = "server.rate_limited"

	CodeCLIGatewayNotRunning Code = "cli.gateway.not_running"
	CodeCLIRequestFailure    Code = "cli.request.failure"
	CodeCLIResponseInvalid   Code = "cli.response.invalid"
	CodeCLISetupFailure      Code = "cli.setup.failure"
	CodeCLIInputInvalid      Code = "cli.input.invalid"

	CodeSecurityCapabilityInvalid         Code = "security.capability.invalid"
	CodeSecurityInvalidInput              Code = "security.input.invalid"
	CodeSecurityAuditFailure              Code = "security.audit.failure"
	CodeSecurityScannerInputBlocked       Code = "security.scanner.input_blocked"
	CodeSecurityScannerToolBlocked        Code = "security.scanner.tool_blocked"
	CodeSecurityScannerOutputBlocked      Code = "security.scanner.output_blocked"
	CodeSecurityScannerContentTooLarge    Code = "security.scanner.content_too_large"
	CodeSecurityScannerFailure            Code = "security.scanner.failure"
	CodeSecurityScannerCancelled          Code = "security.scanner.cancelled"
	CodeSecurityScannerCircuitBreakerOpen Code = "security.scanner.circuit_breaker_open"
	CodeSecurityScannerEmptyRuleStage     Code = "security.scanner.empty_rule_stage"

	CodeChannelTokenInvalid     Code = "channel.token.invalid"
	CodeChannelTokenCheckFailed Code = "channel.token.check_failed"

	CodeChannelPairingRequired Code = "channel.pairing.required"
	CodeChannelPairingDenied   Code = "channel.pairing.denied"
	CodeChannelPairingPending  Code = "channel.pairing.pending"
	CodeChannelBackendFailure  Code = "channel.backend.failure"

	CodeSecretStoreFailure   Code = "secret.store.failure"
	CodeSecretNotFound       Code = "secret.get.not_found"
	CodeSecretDeleteFailure  Code = "secret.delete.failure"
	CodeSecretListFailure    Code = "secret.list.failure"
	CodeSecretInvalidInput   Code = "secret.input.invalid"
	CodeSecretResolveFailure Code = "secret.resolve.failure"

	CodeNodeBindInvalidInput  Code = "node.bind.invalid_input"
	CodeNodeBindLimitExceeded Code = "node.bind.limit_exceeded"
)

func CodeOf

func CodeOf(err error) Code

Jump to

Keyboard shortcuts

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