MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / missingError

Function missingError

db/functions.go:128–134  ·  view source on GitHub ↗

Returns the appropriate HTTP error for when a function/query doesn't exist. For security reasons, we don't let a non-admin user know what function names exist; so instead of a 404 we return the same 401/403 error as if they didn't have access to it.

(user auth.User, what string, name string)

Source from the content-addressed store, hash-verified

126// For security reasons, we don't let a non-admin user know what function names exist;
127// so instead of a 404 we return the same 401/403 error as if they didn't have access to it.
128func missingError(user auth.User, what string, name string) error {
129 if user == nil {
130 return base.HTTPErrorf(http.StatusNotFound, "no such %s %q", what, name)
131 } else {
132 return user.UnauthError(base.HTTPErrorf(http.StatusForbidden, "you are not allowed to call %s %q", what, name))
133 }
134}

Callers 1

GetUserFunctionMethod · 0.85

Calls 2

HTTPErrorfFunction · 0.92
UnauthErrorMethod · 0.65

Tested by

no test coverage detected