Documentation
¶
Overview ¶
Package execerr classifies errors returned from lipsdk.ExecutorView.Execute for HTTP frontends.
Index ¶
Constants ¶
BillingUnavailableWireMessage is the stable client-safe wire message when the authorization store cannot complete admission (HTTP 503).
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).
const ContextLimitExceededWireMessage = "request exceeds context limits for all configured model routes"
ContextLimitExceededWireMessage is returned for lipapi.ErrAllCandidatesContextLimitExceeded (HTTP 413).
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.
const InternalWireMessage = "internal error"
InternalWireMessage is the stable response body for 5xx executor failures (no upstream/raw detail).
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).
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).
const PolicyMalformedWireMessage = "policy decision was malformed"
PolicyMalformedWireMessage is the stable client-safe wire message for malformed policy decisions (requirements 1.5, 6.6).
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 ¶
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 )
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 ¶
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.