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

Function WriteWorkspaceApp404

coderd/workspaceapps/errors.go:18–45  ·  view source on GitHub ↗

WriteWorkspaceApp404 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. The 'warnings' parameter is sent to the user, 'details' is only shown in the logs.

(log slog.Logger, accessURL *url.URL, rw http.ResponseWriter, r *http.Request, appReq *Request, warnings []string, details string)

Source from the content-addressed store, hash-verified

16//
17// The 'warnings' parameter is sent to the user, 'details' is only shown in the logs.
18func WriteWorkspaceApp404(log slog.Logger, accessURL *url.URL, rw http.ResponseWriter, r *http.Request, appReq *Request, warnings []string, details string) {
19 if appReq != nil {
20 slog.Helper()
21 log.Debug(r.Context(),
22 "workspace app 404: "+details,
23 slog.F("username_or_id", appReq.UsernameOrID),
24 slog.F("workspace_and_agent", appReq.WorkspaceAndAgent),
25 slog.F("workspace_name_or_id", appReq.WorkspaceNameOrID),
26 slog.F("agent_name_or_id", appReq.AgentNameOrID),
27 slog.F("app_slug_or_port", appReq.AppSlugOrPort),
28 slog.F("hostname_prefix", appReq.Prefix),
29 slog.F("warnings", warnings),
30 )
31 }
32
33 site.RenderStaticErrorPage(rw, r, site.ErrorPageData{
34 Status: http.StatusNotFound,
35 Title: "Application Not Found",
36 Description: "The application or workspace you are trying to access does not exist or you do not have permission to access it.",
37 Warnings: warnings,
38 Actions: []site.Action{
39 {
40 URL: accessURL.String(),
41 Text: "Back to site",
42 },
43 },
44 })
45}
46
47// WriteWorkspaceApp500 writes a HTML 500 error page for a workspace app. If
48// appReq is not nil, it's fields will be added to the logged error message.

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