v1

package
v0.0.0-...-8d7bd48 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package v1 represents types used by the web application for v1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRequestError

func IsRequestError(err error) bool

IsRequestError checks if an error of type RequestError exists.

func NewRequestError

func NewRequestError(err error, status int) error

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

Types

type ErrorResponse

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

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

type RequestError

type RequestError struct {
	Err    error
	Status int
}

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

func GetRequestError

func GetRequestError(err error) *RequestError

GetRequestError returns a copy of the RequestError pointer.

func (*RequestError) Error

func (re *RequestError) 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.

Directories

Path Synopsis
Package mid contains the set of middleware functions.
Package mid contains the set of middleware functions.
Package paging provides support for query paging.
Package paging provides support for query paging.

Jump to

Keyboard shortcuts

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