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

Function Is404Error

coderd/httpapi/httpapi.go:121–131  ·  view source on GitHub ↗

Is404Error returns true if the given error should return a 404 status code. Both actual 404s and unauthorized errors should return 404s to not leak information about the existence of resources.

(err error)

Source from the content-addressed store, hash-verified

119// Both actual 404s and unauthorized errors should return 404s to not leak
120// information about the existence of resources.
121func Is404Error(err error) bool {
122 if err == nil {
123 return false
124 }
125
126 // This tests for dbauthz.IsNotAuthorizedError and rbac.IsUnauthorizedError.
127 if IsUnauthorizedError(err) {
128 return true
129 }
130 return xerrors.Is(err, sql.ErrNoRows)
131}
132
133func IsUnauthorizedError(err error) bool {
134 if err == nil {

Callers 15

listUserExternalAuthsMethod · 0.92
fileByIDMethod · 0.92
postUserMethod · 0.92
createWorkspaceFunction · 0.92
requestTemplateFunction · 0.92
postWorkspaceUsageMethod · 0.92
workspaceAgentMethod · 0.92

Calls 2

IsUnauthorizedErrorFunction · 0.70
IsMethod · 0.45

Tested by

no test coverage detected