From 3a6181747132dcbb7a0ae3caa8996df3884d31d8 Mon Sep 17 00:00:00 2001
From: James Clark
Date: Thu, 17 Dec 2020 11:45:53 +0700
Subject: [PATCH] Add transaction:Error type
Part of #267.
---
lang/lib/transaction.bal | 6 ++++--
lang/spec.html | 7 ++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/lang/lib/transaction.bal b/lang/lib/transaction.bal
index 15a0f0f7..cbe8f945 100644
--- a/lang/lib/transaction.bal
+++ b/lang/lib/transaction.bal
@@ -14,13 +14,15 @@
// specific language governing permissions and limitations
// under the License.
+
+# Type of error returned by commit action.
+type Error distinct error;
+
# Information about a transaction that does not change
# after the transaction is started.
type Info readonly & record {|
# Unique identifier for the transaction branch
byte[] xid;
- // non-zero means this transaction was a retry of
- // a previous one
# The number of previous attempts in a sequence of retries
int retryNumber;
# Information about the previous attempt in a sequence of retries.
diff --git a/lang/spec.html b/lang/spec.html
index bd0c8f6d..0e9b21e5 100644
--- a/lang/spec.html
+++ b/lang/spec.html
@@ -8736,7 +8736,7 @@ Commit operation
If the transaction manager decided to rollback, then the Commit operation
-returns the error value for the cause of the rollback. Otherwise, it returns
+returns the error value for the reason for the rollback. Otherwise, it returns
nil.
@@ -8845,8 +8845,9 @@ Commit action
Evaluating the commit-action
performs the transaction manager
Commit() operation; the result of this operation is the result of the
-commit-action
. Note that the commit action does not alter the flow
-of control.
+commit-action
. The type of the result is
+transaction:Error?
. Note that the commit action does not alter the
+flow of control.