Skip to content

Commit

Permalink
GOCBC-1048: Update collection manager error message parsing
Browse files Browse the repository at this point in the history
Change-Id: I133849da35e25da3873fad5150070897aefb7233
Reviewed-on: http://review.couchbase.org/c/gocb/+/144367
Tested-by: Charles Dixon <chvckd@gmail.com>
Reviewed-by: Brett Lawson <brett19@gmail.com>
  • Loading branch information
chvck committed Feb 9, 2021
1 parent 7b5d7a3 commit d98a3f6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bucket_collectionsmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ func (cm *CollectionManager) tryParseErrorMessage(req *mgmtRequest, resp *mgmtRe
errText := strings.ToLower(string(b))

if resp.StatusCode == 404 {
if strings.Contains(errText, "not found") && strings.Contains(errText, "scope") {
return makeGenericMgmtError(ErrScopeNotFound, req, resp)
} else if strings.Contains(errText, "not found") && strings.Contains(errText, "scope") {
if strings.Contains(errText, "not_found") && strings.Contains(errText, "collection") {
return makeGenericMgmtError(ErrCollectionNotFound, req, resp)
} else if strings.Contains(errText, "not_found") && strings.Contains(errText, "scope") {
return makeGenericMgmtError(ErrScopeNotFound, req, resp)
}
}

if strings.Contains(errText, "already exists") && strings.Contains(errText, "collection") {
if strings.Contains(errText, "already_exists") && strings.Contains(errText, "collection") {
return makeGenericMgmtError(ErrCollectionExists, req, resp)
} else if strings.Contains(errText, "already exists") && strings.Contains(errText, "scope") {
} else if strings.Contains(errText, "already_exists") && strings.Contains(errText, "scope") {
return makeGenericMgmtError(ErrScopeExists, req, resp)
}

Expand Down

0 comments on commit d98a3f6

Please sign in to comment.