reqres

package
v2.46.9 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 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

Index

Constants

This section is empty.

Variables

APIErrorCodeMapping stores the HTTP error code mapping for various APIErrorCodes.

Functions

func WriteError

func WriteError(w http.ResponseWriter, r *http.Request, code APIErrorCode, message string, e error)

WriteError handles writing error responses.

Types

type APIError

type APIError struct {
	Code    APIErrorCode `json:"code"`
	Message string       `json:"message"`
}

APIError encompasses the error type and message.

type APIErrorCode

type APIErrorCode string

APIErrorCode stores the type of error encountered.

const (
	APIErrorNotFound         APIErrorCode = "RESOURCE_NOT_FOUND"
	APIErrorUnauthenticated  APIErrorCode = "UNAUTHENTICATED"
	APIErrorUntrustedService APIErrorCode = "UNTRUSTED_SERVICE"
	APIErrorUnimplemented    APIErrorCode = "FUNCTION_NOT_IMPLEMENTED"
	APIErrorInvalidParameter APIErrorCode = "INVALID_PARAMETER"
	APIErrorProviderError    APIErrorCode = "PROVIDER_ERROR"
	APIErrorAlreadyExist     APIErrorCode = "ALREADY_EXIST"
	APIErrorServerError      APIErrorCode = "SERVER_ERROR"
)

The various types of errors that can be expected to occur.

Jump to

Keyboard shortcuts

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