(rw http.ResponseWriter, r *http.Request)
| 249 | } |
| 250 | |
| 251 | func (e HTTPError) Write(rw http.ResponseWriter, r *http.Request) { |
| 252 | if e.RenderStaticPage { |
| 253 | site.RenderStaticErrorPage(rw, r, site.ErrorPageData{ |
| 254 | Status: e.Code, |
| 255 | HideStatus: true, |
| 256 | Title: e.Msg, |
| 257 | Description: e.Detail, |
| 258 | Actions: []site.Action{ |
| 259 | { |
| 260 | URL: "/login", |
| 261 | Text: "Back to site", |
| 262 | }, |
| 263 | }, |
| 264 | RenderDescriptionMarkdown: e.RenderDetailMarkdown, |
| 265 | }) |
| 266 | return |
| 267 | } |
| 268 | httpapi.Write(r.Context(), rw, e.Code, codersdk.Response{ |
| 269 | Message: e.Msg, |
| 270 | Detail: e.Detail, |
| 271 | }) |
| 272 | } |
| 273 | |
| 274 | func (e HTTPError) Error() string { |
| 275 | if e.Detail != "" { |
nothing calls this directly
no test coverage detected