MCPcopy Create free account
hub / github.com/chain/Core / Write

Method Write

net/http/httperror/httperror.go:73–77  ·  view source on GitHub ↗

Write writes a json encoded Response to the ResponseWriter. It uses the status code associated with the error. Write may be used as an ErrorWriter in the httpjson package.

(ctx context.Context, w http.ResponseWriter, err error)

Source from the content-addressed store, hash-verified

71//
72// Write may be used as an ErrorWriter in the httpjson package.
73func (f Formatter) Write(ctx context.Context, w http.ResponseWriter, err error) {
74 f.Log(ctx, err)
75 resp := f.Format(err)
76 httpjson.Write(ctx, w, resp.HTTPStatus, resp)
77}
78
79// Log writes a structured log entry to the chain/log logger with
80// information about the error and the HTTP response.

Callers

nothing calls this directly

Calls 2

LogMethod · 0.95
FormatMethod · 0.95

Tested by

no test coverage detected