This is an automated email from the ASF dual-hosted git repository. jiahuili430 pushed a commit to branch fix-catch-warnings in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 6ead92e752ca2d6055e9c98bf4fc8164e6fd0afb Author: Jiahui Li <[email protected]> AuthorDate: Thu Nov 19 13:31:37 2026 -0600 Add `TRY_CATCH` macro --- src/couch/include/couch_db.hrl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/couch/include/couch_db.hrl b/src/couch/include/couch_db.hrl index 138c202d5..b8aede98b 100644 --- a/src/couch/include/couch_db.hrl +++ b/src/couch/include/couch_db.hrl @@ -53,6 +53,19 @@ -define(INTERACTIVE_EDIT, interactive_edit). -define(REPLICATED_CHANGES, replicated_changes). +-define(TRY_CATCH(F, A), ?TRY_CATCH(erlang, apply, [F, A])). +-define(TRY_CATCH(M, F, A), + (fun() -> + try + apply(M, F, A) + catch + throw:__Term -> __Term; + exit:__Reason -> {'EXIT', __Reason}; + error:__Reason:__Stacktrace -> {'EXIT', {__Reason, __Stacktrace}} + end + end)() +). + -type branch() :: {Key::term(), Value::term(), Tree::term()}. -type path() :: {Start::pos_integer(), branch()}. -type update_type() :: replicated_changes | interactive_edit.
