Documentation
¶
Overview ¶
package fault provides a net/http handler for logging errors and rendering them to the browser using custom templates.
Index ¶
- Constants
- func AssignError(req *http.Request, err error, status int) *http.Request
- func FaultHandler(l *log.Logger) (http.Handler, error)
- func RetrieveError(req *http.Request) (int, error)
- func TemplatedFaultHandler(l *log.Logger, t *template.Template) (http.Handler, error)
- type FaultError
- type FaultHandlerVars
Constants ¶
const ErrorKey string = "github.com/sfomuseum/go-http-fault#error"
ErrorKey is the name of the key for assigning `error` values to a `context.Context` instance.
const StatusKey string = "github.com/sfomuseum/go-http-fault#status"
StatusKey is the name of the key for assigning status code values to a `context.Context` instance.
Variables ¶
This section is empty.
Functions ¶
func AssignError ¶
AssignError assigns 'err' and 'status' the `ErrorKey` and `StatusKey` values of 'req.Context' and returns an updated instance of 'req'
func FaultHandler ¶
FaultHandler returns a `http.Handler` instance for handling errors in a web application.
func RetrieveError ¶ added in v0.0.2
RetrieveError returns the values of the `StatusKey` and `ErrorKey` values of 'req.Context'
Types ¶
type FaultError ¶ added in v0.0.4
type FaultError interface { error // Public returns an `error` instance whose string value is considered safe for publishing in a public setting or context. Public() error // Private returns an `error` instance whose string value that may contain details not suitable for publishing in a public setting or context. Private() error }
FaultError is an interface for providing custom public and private error messages.