From 27a5f785fdd2968052f07cb077a826a9ed484919 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 23 Apr 2018 09:12:00 +0100 Subject: [PATCH] =?UTF-8?q?Change=20ERR=5FKV=20to=20ERR=5FEX=20for=20?= =?UTF-8?q?=E2=80=98record=20already=20exists=E2=80=99=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/create_test.go | 12 ++++++------ db/executor.go | 2 +- db/insert_test.go | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/db/create_test.go b/db/create_test.go index 2b8a938d..011c30f4 100644 --- a/db/create_test.go +++ b/db/create_test.go @@ -64,7 +64,7 @@ func TestCreate(t *testing.T) { So(res, ShouldHaveLength, 3) So(res[1].Result, ShouldHaveLength, 1) So(res[2].Result, ShouldHaveLength, 0) - So(res[2].Status, ShouldEqual, "ERR_KV") + So(res[2].Status, ShouldEqual, "ERR_EX") So(res[2].Detail, ShouldEqual, "Database record 'person:test' already exists") }) @@ -272,15 +272,15 @@ func TestCreate(t *testing.T) { So(err, ShouldBeNil) So(res, ShouldHaveLength, 8) So(res[1].Result, ShouldHaveLength, 1) - So(res[2].Status, ShouldEqual, "ERR_KV") + So(res[2].Status, ShouldEqual, "ERR_EX") So(res[2].Detail, ShouldEqual, "Database record 'person:1' already exists") - So(res[3].Status, ShouldEqual, "ERR_KV") + So(res[3].Status, ShouldEqual, "ERR_EX") So(res[3].Detail, ShouldEqual, "Database record 'person:1' already exists") - So(res[4].Status, ShouldEqual, "ERR_KV") + So(res[4].Status, ShouldEqual, "ERR_EX") So(res[4].Detail, ShouldEqual, "Database record 'person:1' already exists") - So(res[5].Status, ShouldEqual, "ERR_KV") + So(res[5].Status, ShouldEqual, "ERR_EX") So(res[5].Detail, ShouldEqual, "Database record 'person:1' already exists") - So(res[6].Status, ShouldEqual, "ERR_KV") + So(res[6].Status, ShouldEqual, "ERR_EX") So(res[6].Detail, ShouldEqual, "Database record 'person:1' already exists") So(res[7].Result, ShouldHaveLength, 1) diff --git a/db/executor.go b/db/executor.go index 0947000d..0f0e8519 100644 --- a/db/executor.go +++ b/db/executor.go @@ -488,7 +488,7 @@ func status(e error) (s string) { case *PermsError: return "ERR_PE" case *ExistError: - return "ERR_KV" + return "ERR_EX" case *FieldError: return "ERR_FD" case *IndexError: diff --git a/db/insert_test.go b/db/insert_test.go index 03a1bc0d..56e47205 100644 --- a/db/insert_test.go +++ b/db/insert_test.go @@ -146,7 +146,7 @@ func TestInsert(t *testing.T) { So(res[2].Result, ShouldHaveLength, 1) So(data.Consume(res[2].Result[0]).Get("login").Data(), ShouldEqual, "joe") So(data.Consume(res[2].Result[0]).Get("meta.id").Data(), ShouldEqual, 360) - So(res[3].Status, ShouldEqual, "ERR_KV") + So(res[3].Status, ShouldEqual, "ERR_EX") So(res[3].Detail, ShouldEqual, "Database record 'users:360' already exists") So(res[4].Result, ShouldHaveLength, 1) So(data.Consume(res[4].Result[0]).Get("login").Data(), ShouldEqual, "joe") @@ -203,7 +203,7 @@ func TestInsert(t *testing.T) { So(data.Consume(res[2].Result[1]).Get("meta.id").Data(), ShouldEqual, 200) So(data.Consume(res[2].Result[2]).Get("login").Data(), ShouldEqual, "tester") So(data.Consume(res[2].Result[2]).Get("meta.id").Data(), ShouldEqual, "test") - So(res[3].Status, ShouldEqual, "ERR_KV") + So(res[3].Status, ShouldEqual, "ERR_EX") So(res[4].Result, ShouldHaveLength, 3) So(data.Consume(res[4].Result[0]).Get("login").Data(), ShouldEqual, "mike") So(data.Consume(res[4].Result[0]).Get("meta.id").Data(), ShouldEqual, 200)