execerr

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package execerr classifies errors returned from lipsdk.ExecutorView.Execute for HTTP frontends.

Index

Constants

View Source
const BillingUnavailableWireMessage = "billing unavailable"

BillingUnavailableWireMessage is the stable client-safe wire message when the authorization store cannot complete admission (HTTP 503).

View Source
const ClientRejectWireMessage = "request rejected"

ClientRejectWireMessage is the stable client-safe wire message for capability rejects whose normalized reason is empty (control-only or whitespace input).

View Source
const ContextLimitExceededWireMessage = "request exceeds context limits for all configured model routes"

ContextLimitExceededWireMessage is returned for lipapi.ErrAllCandidatesContextLimitExceeded (HTTP 413).

View Source
const InsufficientCreditWireMessage = "insufficient credit"

InsufficientCreditWireMessage is the stable client-safe wire message for spendable/account billing denials (HTTP 429). Credit and journal types stay out of lipapi; classification uses billing sentinels only.

View Source
const InternalWireMessage = "internal error"

InternalWireMessage is the stable response body for 5xx executor failures (no upstream/raw detail).

View Source
const PolicyDeniedWireMessage = "request denied by policy"

PolicyDeniedWireMessage is the stable client-safe wire message for policy denials when the decision carries no client message (requirement 5.4).

View Source
const PolicyFailureWireMessage = "policy decision unavailable"

PolicyFailureWireMessage is the stable client-safe wire message for policy decision provider failures handled through fail-closed behavior (requirement 6.1).

View Source
const PolicyMalformedWireMessage = "policy decision was malformed"

PolicyMalformedWireMessage is the stable client-safe wire message for malformed policy decisions (requirements 1.5, 6.6).

View Source
const UnknownExecuteErrorMessage = "unknown error"

UnknownExecuteErrorMessage is the wire-safe message when ClassifyExecute is called with a nil error. Callers should pass only non-nil errors from ExecutorView.Execute; the nil case exists for defensive completeness.

Variables

This section is empty.

Functions

func OpenAIWireErrorType

func OpenAIWireErrorType(status int) string

OpenAIWireErrorType maps HTTP status to OpenAI-compatible error.type strings for frontend adapters.

Types

type Kind

type Kind int
const (
	KindUnspecified Kind = iota
	KindClientReject
	KindInternalError
	// KindSessionDenial is a pre-backend secure-session denial with a stable public code and HTTP status.
	KindSessionDenial
	// KindPolicyDenied is a policy denial before backend output or an active-stream policy denial
	// after output (requirement 5.1). Distinct from capability, session, backend, and internal errors.
	KindPolicyDenied
	// KindPolicyFailure is a fail-closed policy decision provider failure (requirement 6.1).
	KindPolicyFailure
	// KindPolicyMalformed is a malformed policy decision: unknown stage, outcome, effect, or illegal
	// outcome/effect pair (requirements 1.5, 6.6).
	KindPolicyMalformed
	// KindBillingDenied is a pre-Open spendable or account-not-ready denial.
	KindBillingDenied
	// KindBillingUnavailable is an authorization-store failure during admission.
	KindBillingUnavailable
)

type Outcome

type Outcome struct {
	Kind    Kind
	Status  int
	Message string // safe to return to clients on the wire
	// Err is the original error for server-side logging. It is set for KindClientReject and KindInternalError
	// when err != nil; nil only when ClassifyExecute was called with a nil error (see [UnknownExecuteErrorMessage]).
	Err error
	// SessionPublicCode is the lipapi session denial code string when Kind == KindSessionDenial; otherwise empty.
	SessionPublicCode string
}

func ClassifyExecute

func ClassifyExecute(err error) Outcome

ClassifyExecute maps an executor error to HTTP-facing outcome metadata. err must be non-nil in normal use (the value returned from Execute). If err is nil, the result is InternalError with Message UnknownExecuteErrorMessage and Err set to nil—treat that as a programming mistake, not a signal that the upstream call succeeded.

Jump to

Keyboard shortcuts

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