diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-12-23 12:45:35 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-12-23 12:45:35 -0700 |
commit | 95ed603de79c66ff76bfe7e42986a2fc8c7a1fa4 (patch) | |
tree | 1a788b8eba98f0c2e69e5816bac9c7cc09aca96f /modules/caddyhttp/staticerror.go | |
parent | cbb405f6aaee046c9de9ffb4f07ca824d9eedeb1 (diff) |
Improve godocs all around
These will be used in the new automated documentation system
Diffstat (limited to 'modules/caddyhttp/staticerror.go')
-rw-r--r-- | modules/caddyhttp/staticerror.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/caddyhttp/staticerror.go b/modules/caddyhttp/staticerror.go index fd1490d..0ddebfe 100644 --- a/modules/caddyhttp/staticerror.go +++ b/modules/caddyhttp/staticerror.go @@ -27,8 +27,18 @@ func init() { } // 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 response, the error information +// is for use by the server to know how to handle the error. type StaticError struct { - Error string `json:"error,omitempty"` + // The recommended HTTP status code. Can be either an integer or a + // string if placeholders are needed. Optional. Default is 500. + Error string `json:"error,omitempty"` + + // The error message. Optional. Default is no error message. StatusCode WeakString `json:"status_code,omitempty"` } |