apperror

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgsOf

func ArgsOf(err error) map[string]string

func CauseOf

func CauseOf(err error) error

CauseOf is intentionally separate from errors.Unwrap: infrastructure errors are retained for boundary logging without becoming a domain-level contract.

func IsExternalAgentCode added in v0.21.0

func IsExternalAgentCode(code Code) bool

IsExternalAgentCode reports whether code is an External Agent code.

func TypeURI

func TypeURI(code Code) string

Types

type Code

type Code string

Code is the stable machine identity shared by every transport. Client logic may branch on it; it must never branch on Detail or an underlying cause.

const (
	CodeCapabilityNotFound                       Code = "capability.not_found"
	CodeCapabilityApprovalRequired               Code = "capability.approval_required"
	CodeCapabilityOperationFailed                Code = "capability.operation_failed"
	CodeCapabilityRequestInvalid                 Code = "capability.request_invalid"
	CodeCapabilityAccessDenied                   Code = "capability.access_denied"
	CodeWorkspaceDependencyDiscoveryFailed       Code = "workspace_dependency.discovery_failed"
	CodeWorkspaceDependencyDefinitionUnavailable Code = "workspace_dependency.definition_unavailable"
	CodeWorkspaceDependencyDefinitionInvalid     Code = "workspace_dependency.definition_invalid"
	CodeWorkspaceDependencyCatalogUnavailable    Code = "workspace_dependency.catalog_unavailable"
	CodeBotNameTaken                             Code = "bot.name_taken"
	CodeBotAgentNotFound                         Code = "bot_agent.not_found"
	CodeBotAgentNameTaken                        Code = "bot_agent.name_taken"
	CodeBotAgentInvalidRuntime                   Code = "bot_agent.invalid_runtime"
	CodeBotAgentInvalidMetadata                  Code = "bot_agent.invalid_metadata"
	CodeBotAgentDefaultInUse                     Code = "bot_agent.default_in_use"
	CodeBotAgentUnavailable                      Code = "bot_agent.unavailable"
	CodeChannelRuntimeUnavailable                Code = "channel.runtime_unavailable"
	CodeChannelVerificationFailed                Code = "channel.verification_failed"
	CodeCompactionModelUnavailable               Code = "compaction.model_unavailable"
	CodeSettingsReasoningEffortInvalid           Code = "settings.reasoning_effort_invalid"
	CodeSettingsReasoningUnavailable             Code = "settings.reasoning_options_unavailable"
	CodeContextBudgetUnsatisfied                 Code = "context.budget_unsatisfied"
	CodeContextProtectedOverflow                 Code = "context.protected_overflow"
	CodeWorkspaceUnreachable                     Code = "workspace.unreachable"
	CodeWorkspaceTemplateBootstrapFailed         Code = "workspace.template_bootstrap_failed"
	CodeWorkspaceDisplayPrepareFailed            Code = "workspace.display_prepare_failed"
	CodeWorkspaceDependencyNotFound              Code = "workspace_dependency.not_found"
	CodeWorkspaceDependencyRequestInvalid        Code = "workspace_dependency.request_invalid"
	CodeWorkspaceDependencyActionUnsupported     Code = "workspace_dependency.action_unsupported"
	CodeWorkspaceDependencyPlatformUnsupported   Code = "workspace_dependency.platform_unsupported"
	CodeWorkspaceDependencyBusy                  Code = "workspace_dependency.busy"
	CodeWorkspaceDependencyRequired              Code = "workspace_dependency.required"
	CodeWorkspaceDependencyPrerequisitesChanged  Code = "workspace_dependency.prerequisites_changed"
	CodeWorkspaceDependencyWorkspaceNotRunning   Code = "workspace_dependency.workspace_not_running"
	CodeWorkspaceDependencyWorkspaceMissing      Code = "workspace_dependency.workspace_missing"
	CodeWorkspaceDependencyRollbackUnavailable   Code = "workspace_dependency.rollback_unavailable"
	CodeWorkspaceDependencyOperationFailed       Code = "workspace_dependency.operation_failed"
	CodeProviderTemplateNotFound                 Code = "provider_template.not_found"
	CodeProviderTemplateDomainInvalid            Code = "provider_template.domain_invalid"
	CodeProviderTemplateDomainMismatch           Code = "provider_template.domain_mismatch"
	CodeProviderTemplateOperationFailed          Code = "provider_template.operation_failed"
	CodeProviderNameTaken                        Code = "provider.name_taken"
	CodeProviderTemplateRequestInvalid           Code = "provider_template.request_invalid"
	CodeSearchProviderTypeConflict               Code = "search_provider.type_conflict"
	CodeSearchProviderInvalidProvider            Code = "search_provider.invalid_provider"
	CodeConnectorRequestInvalid                  Code = "connector.request_invalid"
	CodeConnectorNotConfigured                   Code = "connector.not_configured"
	CodeConnectorNotFound                        Code = "connector.not_found"
	CodeConnectorConflict                        Code = "connector.conflict"
	CodeConnectorRequestRejected                 Code = "connector.request_rejected"
	CodeConnectorUpstreamUnavailable             Code = "connector.upstream_unavailable"
	CodeConnectorOperationFailed                 Code = "connector.operation_failed"
	CodeSkillBuiltinReadOnly                     Code = "skill.builtin_read_only"
	CodeSkillNameTaken                           Code = "skill.name_taken"
	CodeSkillSaveFailed                          Code = "skill.save_failed"
	CodeAppNotFound                              Code = "app.not_found"
	CodeAppRequestInvalid                        Code = "app.request_invalid"
	CodeAppBusy                                  Code = "app.busy"
	CodeAppOperationFailed                       Code = "app.operation_failed"
	CodeRegistryUnavailable                      Code = "registry.unavailable"
	CodeRegistryAppNotFound                      Code = "registry.app_not_found"
	CodeRegistryAppInvalid                       Code = "registry.app_invalid"
	CodeRegistryAppInstallFailed                 Code = "registry.app_install_failed"
	CodeProfileRequestInvalid                    Code = "profile.request_invalid"
	CodeProfileTitleModelInvalid                 Code = "profile.title_model_invalid"
	CodeProfileUpdateFailed                      Code = "profile.update_failed"
	CodeACPRequestInvalid                        Code = "acp.request_invalid"
	CodeACPAccessForbidden                       Code = "acp.access_forbidden"
	CodeACPRuntimeNotFound                       Code = "acp.runtime_not_found"
	CodeACPRuntimeConflict                       Code = "acp.runtime_conflict"
	CodeACPRuntimeLimitReached                   Code = "acp.runtime_limit_reached"
	CodeACPOperationFailed                       Code = "acp.operation_failed"
	CodeACPCommandNotFound                       Code = "acp.command_not_found"
	CodeExternalAgentTurnReplacementUnsupported  Code = "external_agent.turn_replacement_unsupported"
	CodeACPModelSelectionUnsupported             Code = "acp.model_selection_unsupported"
	CodeACPModelIDRequired                       Code = "acp.model_id_required"
	CodeACPModelUnavailable                      Code = "acp.model_unavailable"
	CodeACPReasoningUnsupported                  Code = "acp.reasoning_selection_unsupported"
	CodeACPReasoningEffortRequired               Code = "acp.reasoning_effort_required"
	CodeACPReasoningUnavailable                  Code = "acp.reasoning_effort_unavailable"
	CodeACPModeSelectionUnsupported              Code = "acp.mode_selection_unsupported"
	CodeACPModeIDRequired                        Code = "acp.mode_id_required"
	CodeACPModeUnavailable                       Code = "acp.mode_unavailable"
	CodeACPConfigUpdateFailed                    Code = "acp.config_update_failed"
	CodeRuntimeControlUnsupported                Code = "runtime_control.unsupported"
	CodeRuntimeControlCommandUnavailable         Code = "runtime_control.command_unavailable"
	CodeRuntimeControlModeUnavailable            Code = "runtime_control.mode_unavailable"
	CodeRuntimeControlGoalRequiresDefaultMode    Code = "runtime_control.goal_requires_default_mode"
	CodeWorkdirGitBusy                           Code = "workdir.git_busy"
	CodeWorkdirGitBranchUnavailable              Code = "workdir.git_branch_unavailable"
	CodeWorkdirGitSwitchFailed                   Code = "workdir.git_switch_failed"
	CodeWorkdirGitUnavailable                    Code = "workdir.git_unavailable"
	CodeRuntimeControlThreadUnavailable          Code = "runtime_control.thread_unavailable"
	CodeRuntimeControlCancelled                  Code = "runtime_control.cancelled"
	CodeRuntimeControlFailed                     Code = "runtime_control.failed"
	CodeRuntimeControlSteerFailed                Code = "runtime_control.steer_failed"
	CodeRuntimeControlForbidden                  Code = "runtime_control.forbidden"
	CodeRuntimeControlRequestInvalid             Code = "runtime_control.request_invalid"
	CodeExternalRuntimeAuthRequired              Code = "external_runtime.auth_required"
	CodeExternalRuntimeUnavailable               Code = "external_runtime.unavailable"
	CodeExternalRuntimeSessionResumeFailed       Code = "external_runtime.session_resume_failed"
	CodeExternalRuntimeUsageLimited              Code = "external_runtime.usage_limited"
	CodeToolApprovalForbidden                    Code = "tool_approval.forbidden"
	CodeToolApprovalNotFound                     Code = "tool_approval.not_found"
	CodeToolApprovalExpired                      Code = "tool_approval.expired"
	CodeToolApprovalAmbiguous                    Code = "tool_approval.ambiguous"
	CodeToolApprovalRequestInvalid               Code = "tool_approval.request_invalid"
	CodeToolApprovalOperationFailed              Code = "tool_approval.operation_failed"
	CodeUserInputForbidden                       Code = "user_input.forbidden"
	CodeUserInputExpired                         Code = "user_input.expired"
	CodeUserInputOperationFailed                 Code = "user_input.operation_failed"
	CodeSessionModelPreferenceConflict           Code = "session.model_preference_conflict"
	CodeSessionBusy                              Code = "session_runtime.session_busy"
	CodeSessionInvocationConflict                Code = "session_runtime.invocation_conflict"
	CodeSessionHistoryInconsistent               Code = "session_runtime.history_inconsistent"
	CodeSessionTurnNotLatest                     Code = "session_runtime.turn_not_latest"
	CodeSessionTurnIncomplete                    Code = "session_runtime.turn_incomplete"
	CodeSessionResetUnavailable                  Code = "session_runtime.reset_unavailable"
	CodeSessionResetConflict                     Code = "session_runtime.reset_conflict"
	CodeHistoryDeleteFailed                      Code = "history.delete_failed"
	CodeSessionPublishFailed                     Code = "session_runtime.publish_failed"
	CodeSessionAbortFailed                       Code = "session_runtime.abort_failed"
	CodeAgentResponseTimeout                     Code = "agent.response_timeout"
	CodeSessionInterrupted                       Code = "session_runtime.interrupted"
	CodeAgentToolTimeout                         Code = "agent.tool_timeout"
	CodeVideoJobOutcomeUnknown                   Code = "video.job_outcome_unknown"
	CodeScheduleExecutionTimeout                 Code = "schedule.execution_timeout"
	CodeAgentResponseInterrupted                 Code = "agent.response_interrupted"
	CodeAgentProviderOverloaded                  Code = "agent.provider_overloaded"
	CodeAgentProviderRateLimited                 Code = "agent.provider_rate_limited"
	CodeAgentProviderQuotaExhausted              Code = "agent.provider_quota_exhausted"
	CodeAgentProviderAuthFailed                  Code = "agent.provider_auth_failed"
	CodeAgentProviderPermissionDenied            Code = "agent.provider_permission_denied"
	CodeAgentProviderRequestRejected             Code = "agent.provider_request_rejected"
	CodeAgentProviderUnreachable                 Code = "agent.provider_unreachable"
	CodeQueueNoActiveRun                         Code = "queue_no_active_run"
	CodeQueueAdmissionOverloaded                 Code = "queue_admission_overloaded"
	CodeQueueAdmissionUnavailable                Code = "queue_admission_unavailable"
	CodeQueueRequestInvalid                      Code = "queue_request_invalid"
	CodeQueueItemNotPending                      Code = "queue_item_not_pending"
	CodeQueueItemNotEditable                     Code = "queue_item_not_editable"

	// Runtime notices: degradations an external agent runtime reports into the
	// conversation (event.RuntimeNotice). Clients localize them from errors.*.
	CodeRuntimeNativeHistoryLost   Code = "native_history_lost"
	CodeRuntimeToolsUnavailable    Code = "tools_unavailable"
	CodeRuntimeElicitationDeclined Code = "elicitation_declined"
	CodeQueueCapacityExceeded      Code = "queue_capacity_exceeded"
	CodeQueueSteerUnsupported      Code = "queue.steer_unsupported"

	CodeContextLifecycleRequestInvalid         Code = "context_lifecycle.request_invalid"
	CodeContextLifecycleAuthenticationRequired Code = "context_lifecycle.authentication_required"
	CodeContextLifecycleAccessDenied           Code = "context_lifecycle.access_denied"
	CodeContextLifecycleNotFound               Code = "context_lifecycle.not_found"
	CodeContextLifecycleLoadFailed             Code = "context_lifecycle.load_failed"
	CodeAgentAuthorizationExpired              Code = "agent_authorization.expired"
	CodeAgentAuthorizationNotReady             Code = "agent_authorization.not_ready"
	CodeAgentAuthorizationLimit                Code = "agent_authorization.limit"
	CodeAgentAuthorizationFailed               Code = "agent_authorization.failed"
	CodeAgentAuthorizationCodeInvalid          Code = "agent_authorization.code_invalid"
	CodeAgentCredentialNotFound                Code = "agent_credential.not_found"                //nolint:gosec // Stable public error code.
	CodeAgentCredentialRequestInvalid          Code = "agent_credential.request_invalid"          //nolint:gosec // Stable public error code.
	CodeAgentCredentialForbidden               Code = "agent_credential.forbidden"                //nolint:gosec // Stable public error code.
	CodeAgentCredentialIncompatible            Code = "agent_credential.incompatible"             //nolint:gosec // Stable public error code.
	CodeAgentCredentialRevoked                 Code = "agent_credential.revoked"                  //nolint:gosec // Stable public error code.
	CodeAgentCredentialReauthRequired          Code = "agent_credential.reauthorization_required" //nolint:gosec // Stable public error code.
	CodeAgentCredentialEncryptionUnavailable   Code = "agent_credential.encryption_unavailable"   //nolint:gosec // Stable public error code.
	CodeAgentCredentialRuntimeBusy             Code = "agent_credential.runtime_busy"             //nolint:gosec // Stable public error code.
	CodeAgentCredentialMaterializationFailed   Code = "agent_credential.materialization_failed"   //nolint:gosec // Stable public error code.
	CodeAgentCredentialUsageAuthExpired        Code = "agent_credential.usage_auth_expired"       //nolint:gosec // Stable public error code.
	CodeAgentCredentialUsageUnavailable        Code = "agent_credential.usage_unavailable"        //nolint:gosec // Stable public error code.

	// Boundary codes for failures that carry no public error of their own:
	// an unclassified failure and a request the caller canceled.
	CodeInternal Code = "internal"
	CodeCanceled Code = "canceled"

	// Framework codes: the HTTP boundary answers a transport-level
	// *echo.HTTPError (routing, method, body limit, binding) with the code for
	// its status.
	CodeHTTPBadRequest           Code = "http.bad_request"
	CodeHTTPUnauthorized         Code = "http.unauthorized"
	CodeHTTPForbidden            Code = "http.forbidden"
	CodeHTTPNotFound             Code = "http.not_found"
	CodeHTTPMethodNotAllowed     Code = "http.method_not_allowed"
	CodeHTTPConflict             Code = "http.conflict"
	CodeHTTPPayloadTooLarge      Code = "http.payload_too_large"
	CodeHTTPUnsupportedMediaType Code = "http.unsupported_media_type"
	CodeHTTPUpgradeRequired      Code = "http.upgrade_required"
	CodeHTTPTooManyRequests      Code = "http.too_many_requests"
	CodeHTTPNotImplemented       Code = "http.not_implemented"
	CodeHTTPBadGateway           Code = "http.bad_gateway"
	CodeHTTPServiceUnavailable   Code = "http.service_unavailable"
	CodeHTTPGatewayTimeout       Code = "http.gateway_timeout"

	CodeSessionNotFound Code = "session.not_found"

	// External Agent codes. They keep the values the removed agent feedback
	// protocol published and history rows still store.
	CodeACPAgentNotFound            Code = "acp_agent_not_found"
	CodeACPAgentNotEnabled          Code = "acp_agent_not_enabled"
	CodeACPAgentNotConfigured       Code = "acp_agent_not_configured"
	CodeCodexOAuthIncomplete        Code = "codex_oauth_incomplete"
	CodeCodexAuthTokenMissing       Code = "codex_auth_token_missing" //nolint:gosec // Stable public error code.
	CodeACPAgentAuthInvalid         Code = "acp_agent_auth_invalid"
	CodeNoWorkspaceExec             Code = "no_workspace_exec"
	CodeACPRuntimeOwnerMissing      Code = "acp_runtime_owner_missing"
	CodeACPDiscussUnsupported       Code = "acp_discuss_unsupported"
	CodeGroupChatACPUnsupported     Code = "group_chat_acp_unsupported"
	CodeACPProjectModeInvalid       Code = "acp_project_mode_invalid"
	CodeACPProjectPathInvalid       Code = "acp_project_path_invalid"
	CodeACPDisplayArgsInvalid       Code = "acp_display_args_invalid"
	CodeACPRuntimeStartFailed       Code = "acp_runtime_start_failed"
	CodeACPRuntimeBusy              Code = "acp_runtime_busy"
	CodeACPAttachmentInvalid        Code = "acp_attachment_invalid"
	CodeACPAttachmentUnavailable    Code = "acp_attachment_unavailable"
	CodeRuntimeAgentCommandStale    Code = "runtime_agent_command_stale"
	CodeACPImageInputUnsupported    Code = "acp_image_input_unsupported"
	CodeInvalidChatRuntime          Code = "invalid_chat_runtime"
	CodeAgentDependencyMissing      Code = "agent_dependency_missing"
	CodeExternalAgentAccountUnbound Code = "external_agent.account_unbound"
	// A direct runtime (Codex, Claude Code) was asked to start in a workspace
	// that is not a container.
	CodeExternalAgentContainerWorkspaceRequired Code = "external_agent.container_workspace_required"

	// Run error codes persisted in session_runs.error_code and history
	// metadata. The writers keep their own constants; these register the same
	// values.
	CodeRuntimeRunFailed             Code = "runtime_run_failed"
	CodeRuntimePromptFailed          Code = "runtime_prompt_failed"
	CodeRuntimeOwnerLeaseExpired     Code = "runtime_owner_lease_expired"
	CodeRuntimeLiveBackendLost       Code = "runtime_live_backend_lost"
	CodeRuntimeAdmissionOrphaned     Code = "runtime_admission_orphaned"
	CodeRuntimeFenceActivationFailed Code = "runtime_fence_activation_failed"
	CodeRuntimeReservationFailed     Code = "runtime_reservation_failed"
	CodeRuntimeReservationDeclined   Code = "runtime_reservation_declined"
	CodeHistoryReset                 Code = "history_reset"

	// Channel queue command codes (internal/channel/inbound/queue_command.go).
	CodeQueueInvocationConflict         Code = "queue_invocation_conflict"
	CodeQueueUnsupportedSession         Code = "queue_unsupported_session"
	CodeQueueFollowUpUnsupportedChannel Code = "queue_follow_up_unsupported_channel"

	// Bot and workspace codes published by the workspace HTTP handlers and the
	// bot creation, display and dependency event streams.
	CodeBotReadyUpdateFailed                    Code = "bot_ready_update_failed"
	CodeWorkspaceSetupTimeout                   Code = "workspace_setup_timeout"
	CodeWorkspaceSetupFailed                    Code = "workspace_setup_failed"
	CodeWorkspaceDisplayDisabled                Code = "workspace_display_disabled"
	CodeWorkspaceDependencyOperationUnknown     Code = "workspace_dependency_operation_unknown"
	CodeWorkspaceCreateRequestInvalid           Code = "workspace_create_request_invalid"
	CodeWorkspaceCreateFailed                   Code = "workspace_create_failed"
	CodeWorkspaceNotFound                       Code = "workspace_not_found"
	CodeWorkspaceLoadFailed                     Code = "workspace_load_failed"
	CodeWorkspaceMetricsLoadFailed              Code = "workspace_metrics_load_failed"
	CodeWorkspaceResourceLimitsInvalid          Code = "workspace_resource_limits_invalid"
	CodeWorkspaceResourceLimitsRequired         Code = "workspace_resource_limits_required"
	CodeWorkspaceResourceLimitsSaveFailed       Code = "workspace_resource_limits_save_failed"
	CodeWorkspaceDeleteFailed                   Code = "workspace_delete_failed"
	CodeWorkspaceStartFailed                    Code = "workspace_start_failed"
	CodeWorkspaceStopFailed                     Code = "workspace_stop_failed"
	CodeWorkspaceSnapshotsUnsupported           Code = "workspace_snapshots_unsupported"
	CodeWorkspaceSnapshotManagerUnavailable     Code = "workspace_snapshot_manager_unavailable"
	CodeWorkspaceSnapshotRequestInvalid         Code = "workspace_snapshot_request_invalid"
	CodeWorkspaceSnapshotCreateFailed           Code = "workspace_snapshot_create_failed"
	CodeWorkspaceSnapshotsLoadFailed            Code = "workspace_snapshots_load_failed"
	CodeWorkspaceSnapshotterMismatch            Code = "workspace_snapshotter_mismatch"
	CodeWorkspaceSnapshotChainNotFound          Code = "workspace_snapshot_chain_not_found"
	CodeWorkspaceManagerUnavailable             Code = "workspace_manager_unavailable"
	CodeWorkspaceSnapshotRollbackRequestInvalid Code = "workspace_snapshot_rollback_request_invalid"
	CodeWorkspaceSnapshotVersionInvalid         Code = "workspace_snapshot_version_invalid"
	CodeWorkspaceSnapshotRollbackFailed         Code = "workspace_snapshot_rollback_failed"
	CodeWorkspacePreservedDataNotFound          Code = "workspace_preserved_data_not_found"
	CodeWorkspaceRestoreFailed                  Code = "workspace_restore_failed"
)

func CodeOf

func CodeOf(err error) Code

type Definition

type Definition struct {
	HTTPStatus  int
	Detail      string
	AllowedArgs []string
	// Fault is the attribution of the code when the status alone would give
	// the wrong one, as for a provider's 429 or 502. Empty leaves it to the
	// error chain: a 4xx status is a client fault, and a 5xx status is this
	// process's fault unless its cause is marked as a dependency's.
	Fault Fault
}

Definition is the single catalog entry for a public error contract. Type URIs and frontend i18n keys are derived mechanically from Code.

func Lookup

func Lookup(code Code) (Definition, bool)

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error keeps the public contract separate from private diagnostics. The cause is intentionally not exposed through Unwrap; transport boundaries may log it through CauseOf without making infrastructure details part of the API.

func As

func As(err error) (*Error, bool)

func New

func New(code Code, args map[string]string) *Error

New creates a public application error without an infrastructure cause.

func Wrap

func Wrap(code Code, cause error, args map[string]string) *Error

Wrap retains a private cause for boundary logging. Only catalog-allowed args are kept for serialization.

func (*Error) Cause added in v0.21.0

func (e *Error) Cause() error

Cause returns the private cause for diagnostic traversal. The errs package walks Cause() as well as Unwrap to find the origin, stack and attributes of a failure. Error deliberately has no Unwrap: errors.Is and errors.As stop at a public error, so code above it cannot branch on what it wraps.

func (*Error) Error

func (e *Error) Error() string

type Fault added in v0.21.0

type Fault string

Fault is the attribution a catalog entry declares for its code: who is at fault when this process answers with it. The values are the fault values of the error contract.

const (
	// FaultClient: the caller must change the request.
	FaultClient Fault = "client"
	// FaultServer: this process failed.
	FaultServer Fault = "server"
	// FaultDependency: a service outside this process failed or refused the
	// call, such as an LLM provider or an external agent runtime.
	FaultDependency Fault = "dependency"
)

type Problem

type Problem struct {
	Type      string            `json:"type" validate:"required"`
	Status    int               `json:"status" validate:"required"`
	Detail    string            `json:"detail" validate:"required"`
	Code      string            `json:"code" validate:"required"`
	Args      map[string]string `json:"args" validate:"required"`
	Fault     string            `json:"fault" validate:"required"`
	RequestID string            `json:"request_id,omitempty"`
	TraceID   string            `json:"trace_id,omitempty"`
}

Problem is the RFC 9457 body of an HTTP error response. Fault and TraceID are filled by the HTTP boundary: fault is its attribution of the error (client, server, dependency or canceled), which a client uses to choose generic copy for a code it does not know.

func ProblemFrom

func ProblemFrom(err error, requestID string) (Problem, bool)

type Public

type Public struct {
	Code      Code              `json:"code"`
	Args      map[string]string `json:"args"`
	Detail    string            `json:"detail"`
	RequestID string            `json:"request_id,omitempty"`
}

Public is the transport-neutral, user-safe representation of an application error. HTTP and streaming transports may wrap it in different envelopes, but must not derive their own code, detail, or metadata.

func PublicFrom

func PublicFrom(err error, requestID string) (Public, bool)

Jump to

Keyboard shortcuts

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