Extended error information (EEP-54) and NIFs

Roger Lipscombe roger@REDACTED
Fri Jun 11 15:17:38 CEST 2021


On Fri, 11 Jun 2021 at 13:30, Lukas Larsson <lukas@REDACTED> 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.


More information about the erlang-questions mailing list