[VOL-2175] Fix error message
Returns a not found error instead of transaction invalid id.
Change-Id: Ida303899d345d5fb1af003366fa557d79703f468
diff --git a/rw_core/core/grpc_nbi_api_handler.go b/rw_core/core/grpc_nbi_api_handler.go
index aff80bc..0245039 100755
--- a/rw_core/core/grpc_nbi_api_handler.go
+++ b/rw_core/core/grpc_nbi_api_handler.go
@@ -33,6 +33,8 @@
"sync"
)
+var errorIdNotFound = status.Error(codes.NotFound, "id-not-found")
+
const (
IMAGE_DOWNLOAD = iota
CANCEL_IMAGE_DOWNLOAD = iota
@@ -142,7 +144,7 @@
var ownedByMe bool
if ownedByMe, err = handler.core.deviceOwnership.OwnedByMe(id); err != nil {
log.Warnw("getting-ownership-failed", log.Fields{"deviceId": id, "error": err})
- return nil, errorTransactionInvalidId
+ return nil, errorIdNotFound
}
acquired, err = txn.Acquired(timeout, ownedByMe)
} else {
diff --git a/rw_core/core/transaction.go b/rw_core/core/transaction.go
index fb3c765..697e811 100644
--- a/rw_core/core/transaction.go
+++ b/rw_core/core/transaction.go
@@ -46,14 +46,14 @@
)
var errorTransactionNotAcquired = status.Error(codes.Canceled, "transaction-not-acquired")
-var errorTransactionInvalidId = status.Error(codes.Canceled, "transaction-invalid-id")
const (
TRANSACTION_COMPLETE = "TRANSACTION-COMPLETE"
)
// Transaction constants used to guarantee the Core processing a request hold on to the transaction until
-// it either completes it (either successfully or times out) or the Core itself crashes (e.g. a server failure).
+// it either completes it (either successfully or times out) or the Core itself crashes (
+// e.g. a server failure).
// If a request has a timeout of x seconds then the Core processing the request will renew the transaction lease
// every x/NUM_TXN_RENEWAL_PER_REQUEST seconds. After the Core completes the request it stops renewing the
// transaction and sets the transaction value to TRANSACTION_COMPLETE. If the processing Core crashes then it