MCPcopy
hub / github.com/caddyserver/caddy / StaticError

Struct StaticError

modules/caddyhttp/staticerror.go:37–44  ·  modules/caddyhttp/staticerror.go::StaticError

StaticError implements a simple handler that returns an error. This handler returns an error value, but does not write a response. This is useful when you want the server to act as if an error occurred; for example, to invoke your custom error handling logic. Since this handler does not write a res

Source from the content-addressed store, hash-verified

35// Since this handler does not write a response, the error information
36// is for use by the server to know how to handle the error.
37type StaticError struct {
38 // The error message. Optional. Default is no error message.
39 Error string `json:"error,omitempty"`
40
41 // The recommended HTTP status code. Can be either an integer or a
42 // string if placeholders are needed. Optional. Default is 500.
43 StatusCode WeakString `json:"status_code,omitempty"`
44}
45
46// CaddyModule returns the Caddy module information.
47func (StaticError) CaddyModule() caddy.ModuleInfo {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected