This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch epoch-order-error
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 31117f244e44ff5c4486d5f4903f2a2a955f2354
Author: Robert Newson <[email protected]>
AuthorDate: Tue Sep 16 18:43:15 2025 +0100

    more informative error if epochs out of order
---
 src/couch/src/couch_db.erl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index b8b8ee708..7b03f9822 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -1807,7 +1807,7 @@ validate_epochs(Epochs) ->
     %% Assert order.
     case Epochs == lists:sort(fun({_, A}, {_, B}) -> B =< A end, Epochs) of
         true -> ok;
-        false -> erlang:error(epoch_order)
+        false -> erlang:error({epoch_order, Epochs})
     end.
 
 is_prefix(Pattern, Subject) ->
@@ -2403,7 +2403,8 @@ is_owner_test() ->
     ?assertNot(is_owner(bar, 99, [{baz, 200}, {bar, 100}, {foo, 1}])),
     ?assertNot(is_owner(baz, 199, [{baz, 200}, {bar, 100}, {foo, 1}])),
     ?assertError(duplicate_epoch, validate_epochs([{foo, 1}, {bar, 1}])),
-    ?assertError(epoch_order, validate_epochs([{foo, 100}, {bar, 200}])).
+    ?assertError({epoch_order, [{foo, 100}, {bar, 200}]},
+         validate_epochs([{foo, 100}, {bar, 200}])).
 
 to_binary(DbName) when is_list(DbName) ->
     ?l2b(DbName);

Reply via email to