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

Function IsMissingDDocError

db/design_doc.go:760–787  ·  view source on GitHub ↗

Similar to IsDocNotFoundError(), but for the specific error returned by GetDDoc/DeleteDDoc

(err error)

Source from the content-addressed store, hash-verified

758
759// Similar to IsDocNotFoundError(), but for the specific error returned by GetDDoc/DeleteDDoc
760func IsMissingDDocError(err error) bool {
761 if err == nil {
762 return false
763 }
764 unwrappedErr := pkgerrors.Cause(err)
765
766 // Walrus
767 if _, ok := unwrappedErr.(sgbucket.MissingError); ok {
768 return true
769 }
770
771 // gocb
772 if strings.Contains(unwrappedErr.Error(), "not_found") {
773 return true
774 }
775
776 // gocb v2
777 if errors.Is(err, gocb.ErrDesignDocumentNotFound) {
778 return true
779 }
780
781 if errors.Is(err, base.ErrNotFound) {
782 return true
783 }
784
785 return false
786
787}
788
789func getViewStoreForDefaultCollection(dbContext *DatabaseContext) (sgbucket.ViewStore, error) {
790 dbCollection, err := dbContext.GetDefaultDatabaseCollection()

Callers 2

removeObsoleteDesignDocsFunction · 0.85
assertDesignDocNotExistsFunction · 0.85

Calls 2

ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by 1

assertDesignDocNotExistsFunction · 0.68