package errhttp

import "github.com/containerd/errdefs/errhttp"

Package errhttp provides utility functions for translating errors to and from a HTTP context.

The functions ToHTTP and ToNative can be used to map server-side and client-side errors to the correct types.

Index

Functions

func ToHTTP

func ToHTTP(err error) int

ToHTTP returns the best status code for the given error

func ToNative

func ToNative(statusCode int) error

ToNative returns the error best matching the HTTP status code

Source Files

http.go

Version
v0.2.0
Published
Sep 2, 2024
Platform
darwin/amd64
Imports
4 packages
Last checked
1 hour ago

Tools for package owners.