MCPcopy Index your code
hub / github.com/coder/coder / WriteWorkspaceAppOffline

Function WriteWorkspaceAppOffline

coderd/workspaceapps/errors.go:82–110  ·  view source on GitHub ↗

WriteWorkspaceAppOffline writes a HTML 404 error page for a workspace app. If appReq is not nil, it will be used to log the request details at debug level.

(log slog.Logger, accessURL *url.URL, rw http.ResponseWriter, r *http.Request, appReq *Request, msg string)

Source from the content-addressed store, hash-verified

80// WriteWorkspaceAppOffline writes a HTML 404 error page for a workspace app. If
81// appReq is not nil, it will be used to log the request details at debug level.
82func WriteWorkspaceAppOffline(log slog.Logger, accessURL *url.URL, rw http.ResponseWriter, r *http.Request, appReq *Request, msg string) {
83 if appReq != nil {
84 slog.Helper()
85 log.Debug(r.Context(),
86 "workspace app unavailable: "+msg,
87 slog.F("username_or_id", appReq.UsernameOrID),
88 slog.F("workspace_and_agent", appReq.WorkspaceAndAgent),
89 slog.F("workspace_name_or_id", appReq.WorkspaceNameOrID),
90 slog.F("agent_name_or_id", appReq.AgentNameOrID),
91 slog.F("app_slug_or_port", appReq.AppSlugOrPort),
92 slog.F("hostname_prefix", appReq.Prefix),
93 )
94 }
95
96 site.RenderStaticErrorPage(rw, r, site.ErrorPageData{
97 Status: http.StatusNotFound,
98 Title: "Application Unavailable",
99 Description: msg,
100 Actions: []site.Action{
101 {
102 Text: "Retry",
103 },
104 {
105 URL: accessURL.String(),
106 Text: "Back to site",
107 },
108 },
109 })
110}
111
112// WriteWorkspaceOffline writes a HTML 400 error page for a workspace app. If
113// appReq is not nil, it will be used to log the request details at debug level.

Callers 1

IssueMethod · 0.85

Calls 4

RenderStaticErrorPageFunction · 0.92
HelperMethod · 0.65
ContextMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected