From a1f83de1fef84252b2cbc2b8d438d46364cc73a9 Mon Sep 17 00:00:00 2001 From: Dennis Lee Date: Mon, 27 Feb 2023 19:46:42 +0000 Subject: [PATCH] Fix for Issue #92 Fix error message in bulkblocks2 to show actual error message Fix integration test to pass with the new change --- dbs/bulkblocks2.go | 3 +-- test/int_bulkblocks.go | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dbs/bulkblocks2.go b/dbs/bulkblocks2.go index 69ea084..e19871e 100644 --- a/dbs/bulkblocks2.go +++ b/dbs/bulkblocks2.go @@ -453,8 +453,7 @@ func checkBlockExist(bName, hash string) error { } defer tx.Rollback() if rid, err := GetID(tx, "BLOCKS", "block_id", "block_name", bName); err == nil && rid != 0 { - err := errors.New(fmt.Sprintf("Block %s already exists", bName)) - msg := "Data already exist in DBS" + msg := fmt.Sprintf("Block %s already exists", bName) return Error(err, BlockAlreadyExists, msg, "dbs.bulkblocks.checkBlockExist") } return nil diff --git a/test/int_bulkblocks.go b/test/int_bulkblocks.go index 371ff80..1fd52cd 100644 --- a/test/int_bulkblocks.go +++ b/test/int_bulkblocks.go @@ -113,12 +113,11 @@ func getBulkBlocksLargeFileLumiInsertTestTable(t *testing.T) EndpointTestCase { func bulkblocksTheSameBlockInsertTestTable(t *testing.T) EndpointTestCase { // there are multiple blocks to insert, but everything is started from parent blocks bName := TestData.ParentStepchainBlock - reason := fmt.Sprintf("Block %s already exists", bName) - msg := "Data already exist in DBS" + msg := fmt.Sprintf("Block %s already exists", bName) dbsError := dbs.DBSError{ Function: "dbs.bulkblocks.checkBlockExist", Code: dbs.BlockAlreadyExists, - Reason: reason, + Reason: "nil", Message: msg, } hrec := createHTTPError("POST", "/dbs/bulkblocks")