jsonerr

package
v1.5.30 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, r *Response, httpcode int)

JsonError works like http.Error but uses our response struct as the body of the response. Like http.Error you will still need to call a naked return in the http handler

Types

type Additional

type Additional interface{}

type Response

type Response struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	// Additional must be json serializable or expect errors
	Additional `json:"additional,omitempty"`
}

Jump to

Keyboard shortcuts

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