Documentation
¶
Overview ¶
Package platformerr gives platform errors a code that survives wrapping and the p2p wire, and turns it into a public HTTP answer that never shows the internal error text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
func Serve(w http.ResponseWriter, r *http.Request, log Logger, h func(http.ResponseWriter, *http.Request) error)
Serve runs h and answers its error with Write. The full error chain goes to log only. If h already started the response, an error body would corrupt it, and ending it cleanly would show the client a short body as a whole one, so the connection is aborted: net/http closes it without logging the panic.
Types ¶
type Code ¶
type Code string
const ( NotFound Code = "not_found" NodeBusy Code = "node_busy" FunctionError Code = "function_error" FunctionTimeout Code = "function_timeout" Internal Code = "internal" OverQuota Code = "over_quota" // Rejected is a request refused for what the caller sent (a bad signature): // logged as a warning, since anyone can send one. Rejected Code = "rejected" )