From a048c2137854d5e76d1b04033fbf7d4574fc3f84 Mon Sep 17 00:00:00 2001 From: Ben Brooks Date: Fri, 7 Jun 2024 17:15:03 +0100 Subject: [PATCH] [3.1.7 backport] Reword missing collection error --- rest/admin_api.go | 2 +- rest/adminapitest/admin_api_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rest/admin_api.go b/rest/admin_api.go index 9afcc0a94f..e3de4ac072 100644 --- a/rest/admin_api.go +++ b/rest/admin_api.go @@ -123,7 +123,7 @@ func (h *handler) handleCreateDB() error { return httpErr } if errors.Is(err, base.ErrAuthError) { - return base.HTTPErrorf(http.StatusForbidden, "Provided credentials do not have access to specified bucket/scope/collection") + return base.HTTPErrorf(http.StatusForbidden, "The specified bucket/scope/collection does not exist, or the provided credentials do not have access to it") } if errors.Is(err, base.ErrAlreadyExists) { return base.HTTPErrorf(http.StatusConflict, "couldn't load database: %s", err) diff --git a/rest/adminapitest/admin_api_test.go b/rest/adminapitest/admin_api_test.go index 32169e418f..95e7480c3b 100644 --- a/rest/adminapitest/admin_api_test.go +++ b/rest/adminapitest/admin_api_test.go @@ -3612,10 +3612,10 @@ func TestCreateDbOnNonExistentBucket(t *testing.T) { resp := rest.BootstrapAdminRequest(t, http.MethodPut, "/db/", `{"bucket": "nonexistentbucket"}`) resp.RequireStatus(http.StatusForbidden) - assert.Contains(t, resp.Body, "Provided credentials do not have access to specified bucket/scope/collection") + assert.Contains(t, resp.Body, "The specified bucket/scope/collection does not exist, or the provided credentials do not have access to it") resp = rest.BootstrapAdminRequest(t, http.MethodPut, "/nonexistentbucket/", `{}`) resp.RequireStatus(http.StatusForbidden) - assert.Contains(t, resp.Body, "Provided credentials do not have access to specified bucket/scope/collection") + assert.Contains(t, resp.Body, "The specified bucket/scope/collection does not exist, or the provided credentials do not have access to it") } func TestPutDbConfigChangeName(t *testing.T) {