Store the error code for clients Clients of the transactional API may need to refer to which error occurred in order to react appropriately on transaction retries.
diff --git a/src/erlfdb.erl b/src/erlfdb.erl index 104d282..3c49e46 100644 --- a/src/erlfdb.erl +++ b/src/erlfdb.erl
@@ -131,10 +131,12 @@ transactional(?IS_DB = Db, UserFun) when is_function(UserFun, 1) -> Tx = create_transaction(Db), try + put(erlfdb_error, undefined), Ret = UserFun(Tx), wait(commit(Tx)), Ret catch error:{erlfdb_error, Code} -> + put(erlfdb_error, Code), wait(on_error(Tx, Code)), transactional(Db, UserFun) end;