aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif_api_funcs.h
diff options
context:
space:
mode:
authorSteve Vinoski <[email protected]>2015-05-06 23:15:04 -0400
committerSteve Vinoski <[email protected]>2015-05-26 11:59:24 -0400
commit17735c9f3879145f43a3e4be0369b7117b1b7b84 (patch)
tree023c9e747367897606aca135e39e6f1f1fae5788 /erts/emulator/beam/erl_nif_api_funcs.h
parent884afd8efb8672df2889df98b5b94f3dbb53952c (diff)
downloadotp-17735c9f3879145f43a3e4be0369b7117b1b7b84.tar.gz
otp-17735c9f3879145f43a3e4be0369b7117b1b7b84.tar.bz2
otp-17735c9f3879145f43a3e4be0369b7117b1b7b84.zip
Add enif_raise_exception
Add enif_raise_exception function to allow NIFs to raise error exceptions holding any Erlang terms. This does not replace or deprecate the enif_make_badarg function, though, because raising badarg errors is so idiomatic in NIFs. Reimplement enif_make_badarg on top of enif_raise_exception. Add new tests for enif_raise_exception for both normal and dirty NIFs. Add documentation for enif_raise_exception.
Diffstat (limited to 'erts/emulator/beam/erl_nif_api_funcs.h')
-rw-r--r--erts/emulator/beam/erl_nif_api_funcs.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_nif_api_funcs.h b/erts/emulator/beam/erl_nif_api_funcs.h
index fe25c803ec..e38a016958 100644
--- a/erts/emulator/beam/erl_nif_api_funcs.h
+++ b/erts/emulator/beam/erl_nif_api_funcs.h
@@ -157,6 +157,7 @@ ERL_NIF_API_FUNC_DECL(int, enif_map_iterator_prev, (ErlNifEnv *env, ErlNifMapIte
ERL_NIF_API_FUNC_DECL(int, enif_map_iterator_get_pair, (ErlNifEnv *env, ErlNifMapIterator *iter, ERL_NIF_TERM *key, ERL_NIF_TERM *value));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_schedule_nif,(ErlNifEnv*,const char*,int,ERL_NIF_TERM (*)(ErlNifEnv*,int,const ERL_NIF_TERM[]),int,const ERL_NIF_TERM[]));
ERL_NIF_API_FUNC_DECL(int, enif_has_pending_exception, (ErlNifEnv *env, ERL_NIF_TERM* reason));
+ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM, enif_raise_exception, (ErlNifEnv *env, ERL_NIF_TERM reason));
/*
** ADD NEW ENTRIES HERE (before this comment) !!!
@@ -307,6 +308,7 @@ ERL_NIF_API_FUNC_DECL(int,enif_is_on_dirty_scheduler,(ErlNifEnv*));
# define enif_map_iterator_get_pair ERL_NIF_API_FUNC_MACRO(enif_map_iterator_get_pair)
# define enif_schedule_nif ERL_NIF_API_FUNC_MACRO(enif_schedule_nif)
# define enif_has_pending_exception ERL_NIF_API_FUNC_MACRO(enif_has_pending_exception)
+# define enif_raise_exception ERL_NIF_API_FUNC_MACRO(enif_raise_exception)
/*
** ADD NEW ENTRIES HERE (before this comment)