errors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errors provides internal error handling and presentation for Tavern.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapHandler

func WrapHandler(fn func(http.ResponseWriter, *http.Request) error) http.Handler

WrapHandler provides middleware for handlers to present errors to the user if any occur.

Types

type HTTP

type HTTP struct {
	WrappedErr error
	StatusCode int
}

HTTP wraps an error with a desired response status code, useful for error presentation.

func NewHTTP

func NewHTTP(msg string, statusCode int) HTTP

NewHTTP creates a new wrapped HTTP error that can be used for error presentation.

func (HTTP) Error

func (err HTTP) Error() string

Error presents the underlying error

Jump to

Keyboard shortcuts

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