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

Function IsDocNotFoundError

base/error.go:224–250  ·  view source on GitHub ↗

IsDocNotFoundError returns true if an error is a doc-not-found error

(err error)

Source from the content-addressed store, hash-verified

222
223// IsDocNotFoundError returns true if an error is a doc-not-found error
224func IsDocNotFoundError(err error) bool {
225 if err == nil {
226 return false
227 }
228 if errors.Is(err, ErrNotFound) {
229 return true
230 }
231
232 if errors.Is(err, gocb.ErrDocumentNotFound) {
233 return true
234 }
235
236 var missingError sgbucket.MissingError
237 if errors.As(err, &missingError) {
238 return true
239 }
240 unwrappedErr := pkgerrors.Cause(err)
241
242 switch unwrappedErr := unwrappedErr.(type) {
243 case *gomemcached.MCResponse:
244 return unwrappedErr.Status == gomemcached.KEY_ENOENT || unwrappedErr.Status == gomemcached.NOT_STORED
245 case *HTTPError:
246 return unwrappedErr.Status == http.StatusNotFound
247 default:
248 return false
249 }
250}
251
252// IsTemporaryKvError returns true if a kv operation has an error that is likely to be ephemeral. This represents
253// situations where Couchbase Server is under load and would be expected to return a success or failure in a future call.

Callers 15

GetUserByEmailMethod · 0.92
InvalidateChannelsMethod · 0.92
InvalidateRolesMethod · 0.92
AuthenticateUserMethod · 0.92
AuthenticateCookieMethod · 0.92
deleteOneTimeSessionMethod · 0.92
processEventMethod · 0.92
handleGetDocMethod · 0.92

Calls

no outgoing calls