Skip to content

Instantly share code, notes, and snippets.

@nickva
Last active May 23, 2024 17:09
Show Gist options
  • Save nickva/ee96b3a2e65963a28da3eae71ae7bfab to your computer and use it in GitHub Desktop.
Save nickva/ee96b3a2e65963a28da3eae71ae7bfab to your computer and use it in GitHub Desktop.
recon trace return errors only
> recon_trace:calls({fabric, design_docs, fun(_) -> exception_trace() end}, 10, [
{formatter, fun
({trace, _, exception_from, MFA, Err}) -> io_lib:format("|~p:~p|~n", [MFA,Err]);
({trace, _, return_from, MFA, {IsOk,_}=Res}) when IsOk =/= ok -> io_lib:format("|~p:~p|n", [MFA,Res]);
(_) -> ""
end}
]).
@nickva
Copy link
Author

nickva commented May 23, 2024

Call with a failure

> (node1@127.0.0.1)75> fabric:design_docs(x).
** exception error: no function clause matching couch_db:name(x) (src/couch_db.erl, line 839)
     in function  fabric:dbname/1 (src/fabric.erl, line 628)
     in call from fabric:design_docs/1 (src/fabric.erl, line 560)

Call with a success

(node1@127.0.0.1)76> fabric:design_docs(<<"db">>).
{ok,[]}

Tracer logs failures only:

> |{fabric,design_docs,1}:{error,function_clause}|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment