api

package
v0.0.0-...-55f2d51 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJson

func WriteJson(w http.ResponseWriter, data interface{}, status int)

func WriteText

func WriteText(w http.ResponseWriter, data string, status int)

Types

type Error

type Error interface {
	error
	Status() int
}

Error represents a handler error. It provides methods for a HTTP status code and embeds the built-in error interface.

func NewApiError

func NewApiError(code int, err error) Error

type StatusError

type StatusError struct {
	Code int
	Err  error
}

func (StatusError) Error

func (se StatusError) Error() string

Allows StatusError to satisfy the error interface.

func (StatusError) Status

func (se StatusError) Status() int

Returns our HTTP status code.

Jump to

Keyboard shortcuts

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