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
| 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. |
| 37 | type 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. |
| 47 | func (StaticError) CaddyModule() caddy.ModuleInfo { |
nothing calls this directly
no outgoing calls
no test coverage detected