api

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: BSD-2-Clause Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccepted error = NewError(http.StatusAccepted, fmt.Errorf("Accepted")) // 202

Partial success from AddLeaf, caller should retry.

View Source
var ErrConflict error = NewError(http.StatusConflict, fmt.Errorf("Conflict"))

Failure of witness AddTreeHead, caller should retry with correct tree size.

View Source
var ErrForbidden error = NewError(http.StatusForbidden, fmt.Errorf("Forbidden")) // 403

Unauthorized, typically because signature is invalid, or public key not recognized.

View Source
var ErrNotFound error = NewError(http.StatusNotFound, fmt.Errorf("Not Found")) // 404

E.g., GetInclusionProof fails because leaf isn't included.

View Source
var ErrTooManyRequests error = NewError(http.StatusTooManyRequests, fmt.Errorf("Too Many Requests")) // 429

Error due to exceeded rate limit.

View Source
var ErrUnprocessableEntity error = NewError(422, fmt.Errorf("Unprocessable Entity"))

Failure of witness AddTreeHead, invalid consistency proof.

Functions

func ErrorStatusCode

func ErrorStatusCode(err error) int

Types

type Error

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

An error with an associated HTTP status code.

func NewError

func NewError(statusCode int, err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(err error) bool

An error is considered matching if the status code is the same. Example usage:

if errors.Is(api.ErrNotFound, err) {...}

func (*Error) StatusCode

func (e *Error) StatusCode() int

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

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