Skip to content

Commit

Permalink
Rethrow a CommitFail exception upon auto-commit failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene Gleyzer committed Feb 28, 2025
1 parent 15679a4 commit cfc3fff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lib_oodb/src/main/x/oodb/Transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,17 @@ interface Transaction<Schema extends RootSchema>

if (e == Null && !rollbackOnly) {
try {
commit();
switch(CommitResult result = commit()) {
case RollbackOnly:
case DeferredFailed:
case ConcurrentConflict:
case ValidatorFailed:
case RectifierFailed:
case DistributorFailed:
case DatabaseError:
failure = new CommitFailed(txInfo, result);
break;
}
} catch (Exception commitFailed) {
failure = commitFailed;
}
Expand Down
2 changes: 1 addition & 1 deletion lib_web/src/main/x/web.x
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ module web.xtclang.org {
* Example:
*
* @OnError
* void handleErrors(RequestIn request, Exception|String) {...}
* ResponseOut handleErrors(RequestIn request, Exception|String) {...}
*/
mixin OnError
into Method<WebService, <RequestIn, Exception|String|HttpStatus>, <ResponseOut>>;
Expand Down

0 comments on commit cfc3fff

Please sign in to comment.