Similar to IsDocNotFoundError(), but for the specific error returned by GetDDoc/DeleteDDoc
(err error)
| 758 | |
| 759 | // Similar to IsDocNotFoundError(), but for the specific error returned by GetDDoc/DeleteDDoc |
| 760 | func 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 | |
| 789 | func getViewStoreForDefaultCollection(dbContext *DatabaseContext) (sgbucket.ViewStore, error) { |
| 790 | dbCollection, err := dbContext.GetDefaultDatabaseCollection() |