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)
| 16 | // |
| 17 | // The 'warnings' parameter is sent to the user, 'details' is only shown in the logs. |
| 18 | func 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. |
no test coverage detected