I've got this code
frag, err := bucket.LookupIn(req.Key).Get(req.Path).Execute()
if err != nil {
res.Code = 1
res.What = err.Error()
} else {
frag.Content(req.Path, &res.Data)
}
If I'm trying to request some path which does not exist in the document, I'm getting the error message "could not execute one or more multi lookups or mutations", which also seems to occur on certain different circumstances. How can I distinguish missing data on path from all other kinds of subdoc errors? I'd like to have something like this:
frag, err := bucket.LookupIn(req.Key).Get(req.Path).Execute()
if err != nil {
if <no data> {
res.Code = 2
res.What = "No data on specified path"
} else {
res.Code = 1
res.What = err.Error()
}
} else {
frag.Content(req.Path, &res.Data)
}
You should be able to compare the error values you get back against the list of known error types you can find here: https://godoc.org/github.com/couchbase/gocb#pkg-variables