With this code:
_, mutateErr := bucket.Bucket.MutateInEx(k, gocb.SubdocDocFlagNone, gocb.Cas(0), uint32(0)).
RemoveEx(xattrKey, gocb.SubdocFlagXattr). // Remove the xattr
RemoveEx("", gocb.SubdocFlagNone). // Delete the document body
Execute()
I’m getting an error subdocument mutation 0 failed (sub-document path does not exist)
. I’m having trouble doing a comparison against the error however, to try to determine the error type. Eg:
if mutateErr == gocb.ErrSubDocPathNotFound {
...
} else {
.. another kind of error <-- ends up here
}
Isn’t matching as expected. When I dug into it a bit more, it looks like it’s a gocb.ErrSubDocPathNotFound
error wrapped inside of a gocbcore.SubDocMutateError
.
mutateErr: %!p(gocbcore.SubDocMutateError={0x17931da 0}) gocb.ErrSubDocPathNotFound: 0x17931da
What’s the best way to check whether errors are gocb.ErrSubDocPathNotFound
errors?
I’m using gocb commit: https://github.com/couchbase/gocb/commit/0cd63ba8b594091ea0005ec50ee21299e0b22d97