errs

package
v0.0.0-...-53b8cb7 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package errs provides types and support related to web v1 functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTrusted

func IsTrusted(err error) bool

IsTrusted checks if an error of type TrustedError exists.

func NewTrusted

func NewTrusted(err error, status int) error

NewTrusted wraps a provided error with an HTTP status code. This function should be used when handlers encounter expected errors.

Types

type Response

type Response struct {
	Error  string            `json:"error"`
	Fields map[string]string `json:"fields,omitempty"`
}

Response is the form used for API responses from failures in the API.

type Trusted

type Trusted struct {
	Err    error
	Status int
}

Trusted is used to pass an error during the request through the application with web specific context.

func GetTrusted

func GetTrusted(err error) *Trusted

GetTrusted returns a copy of the TrustedError pointer.

func (*Trusted) Error

func (te *Trusted) Error() string

Error implements the error interface. It uses the default message of the wrapped error. This is what will be shown in the services' logs.

Jump to

Keyboard shortcuts

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