apierrors

package
v0.0.0-...-86cb503 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 3 Imported by: 4 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package apierrors sends API errors from gin handlers. The error type and its HTTP encoding live in httperror, which has no gin dependency.

Index

Constants

View Source
const (
	UndefinedRetry = httperror.UndefinedRetry
	CanRetry       = httperror.CanRetry
	NoRetry        = httperror.NoRetry
)
View Source
const ShouldRetryHeader = httperror.ShouldRetryHeader

Variables

This section is empty.

Functions

func SendAPIError

func SendAPIError(c *gin.Context, apiErr *APIError)

SendAPIError sends a JSON error response like SendAPIStoreError, adding error_code to the body when the error carries a semantic code, and setting Should-Retry when Retryable is explicit, otherwise leaving the header unchanged.

func SendAPIStoreError

func SendAPIStoreError(c *gin.Context, code int, message string)

SendAPIStoreError sends a JSON error response and records the error on the gin context.

Types

type APIError

type APIError = httperror.APIError

APIError represents a structured error with an HTTP status code and client-facing message.

type Retryability

type Retryability = httperror.Retryability

Directories

Path Synopsis
Package httperror holds the API's error type and its HTTP response, with no web framework dependency, so any net/http server can answer in the API's error shape.
Package httperror holds the API's error type and its HTTP response, with no web framework dependency, so any net/http server can answer in the API's error shape.

Jump to

Keyboard shortcuts

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