Re: Extended error information (EEP-54) and NIFs

Roger Lipscombe <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAJgnQd8E+t1MgJ8C_mmOV5zgRGGRw5usw7tCh9HF=MNTFa=q+w@mail.gmail.com>
On Fri, 11 Jun 2021 at 13:30, Lukas Larsson <[email protected]> wrote:
> 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:
>
> my_wrapper(Arg1) ->
>   try my_nif(Arg1)
>   catch error:badarg ->
>     error(badarg, [Arg1], [{error_info, #{}}])
>   end.

Thanks. That's useful to know. The actual use-case, however, was "why
is evp_generate_key_nif returning badarg?". You'll note that that's
not one of *my* NIFs :-)

So that got me thinking about why the crypto NIFs haven't been
extended with EEP-54 yet. "no NIF primitives yet" answers my question,
thanks.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.