Documentation

Overview

Package errhttp provides some useful helpers on top of the errors package for HTTP handling.

errhttp is a great example of how to use the errors package SetData and GetData hierarchical methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorBody

func GetErrorBody(err error) string

GetErrorBody will return the user-visible error message given an error. The message will be determined by errors.GetMessage() unless the error class has an error body overridden by OverrideErrorBody.

func GetStatusCode

func GetStatusCode(err error, default_code int) int

GetStatusCode will return the status code associated with an error, and default_code if none is found.

func OverrideErrorBody

func OverrideErrorBody(message string) errors.ErrorOption

OverrideErrorBody returns an ErrorOption (for use in ErrorClass creation or error instantiation) that controls the error body seen by GetErrorBody.

func RestoreDefaultErrorBody

func RestoreDefaultErrorBody() errors.ErrorOption

RestoreDefaultErrorBody returns an ErrorOption (for use in ErrorClass creation or error instantiation) that restores the default error body shown by GetErrorBody for some subhierarchy of errors.

func SetStatusCode

func SetStatusCode(code int) errors.ErrorOption

SetStatusCode returns an ErrorOption (for use in ErrorClass creation or error instantiation) that controls the error's HTTP status code

Types

This section is empty.

Source Files