<div dir="ltr"><div>Hello,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 11, 2021 at 12:30 PM Roger Lipscombe <<a href="mailto:roger@differentpla.net">roger@differentpla.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The extended error information in EEP-54 is amazing, but I only see<br>
mention of BIFs in the notes. Can it be applied to NIFs as well? If<br>
so, are there any examples/documentation?<br></blockquote><div><br></div><div>There are no NIF primitives yet to raise that type of exception, but we have been talking about adding them. The best you can do now is to throw an error and catch it in a NIF wrapper and then rethrow it again with the extra error_info. Something like:</div><div><br></div><div>my_wrapper(Arg1) -></div><div>  try my_nif(Arg1)</div><div>  catch error:badarg -></div><div>    error(badarg, [Arg1], [{error_info, #{}}])</div><div>  end.</div><div><br></div><div>format_error(_Reason, [{?MODULE, my_wrapper, 1, _}|_]) -></div><div>  #{ 1 => "invalid password" }.</div><div><br></div><div>Lukas</div></div></div>