Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteHTTPError ¶
func WriteHTTPError(parseW http.ResponseWriter, parseStatus int, parseReport Report)
WriteHTTPError emits the report to the server log and writes the CLIENT-SAFE subset (Report.FormattedPublic — summary/code/next/docs only) as a plain-text HTTP error response. It deliberately does NOT send stack frames, absolute build paths (which disclose the OS username / server filesystem layout), or the where/path/error/runtime detail to the client — that lives in the server log via Emit. Use WriteHTTPErrorVerbose only for a trusted/dev diagnostics endpoint where the full report in the response body is intended (#60).
This lives behind !js so browser/wasm builds never link net/http: that import chain (http → crypto/tls → x509 → dnsmessage) costs roughly a megabyte of wasm for a helper only servers can call.
func WriteHTTPErrorVerbose ¶
func WriteHTTPErrorVerbose(parseW http.ResponseWriter, parseStatus int, parseReport Report)
WriteHTTPErrorVerbose is the opt-in full-disclosure variant: it writes the complete Formatted() report (including stack frames and build paths) to the HTTP client. Use it ONLY on trusted/local diagnostics endpoints; never on a public error path.
Types ¶
type Report ¶
type Report struct {
Summary string
Code string
Headline string
Where string
Path string
Error string
Runtime string
Next string
Docs string
AppFrames []string
FrameworkFrames []string
PlatformFrames []string
}
func Build ¶
Build constructs a Report from the given Options, capturing and classifying a stack trace.
func (Report) FormattedPublic ¶
FormattedPublic returns a client-safe rendering of the report: only the app-authored fields (summary, code/headline, next step, docs link). It deliberately OMITS where/path/error/runtime and every stack frame — those come from debug.Stack() and embed absolute build paths (which leak the OS username and the server's filesystem layout) plus internal call structure. That detail belongs in the server log (Emit → stderr), never in an HTTP response body sent to an untrusted client.