From 884afd8efb8672df2889df98b5b94f3dbb53952c Mon Sep 17 00:00:00 2001
From: Steve Vinoski
Date: Mon, 27 Apr 2015 23:39:37 -0400
Subject: Enhance enif_has_pending_exception
Sverker Eriksson came up with the following idea: to handle a future
ability for NIFs to raise more than just badarg exceptions, modify the
recently-added enif_has_pending_exception function to take a second
argument: a pointer to ERL_NIF_TERM. If this argument is a null
pointer, ignore it. Otherwise, if the first argument, an ErlNifEnv*,
has an associated exception, set the pointed-to ERL_NIF_TERM of the
second argument to the value of the exception term. Add new tests and
documentation for this modification.
---
erts/doc/src/erl_nif.xml | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
(limited to 'erts/doc')
diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml
index 4bad8b253c..155aee2f42 100644
--- a/erts/doc/src/erl_nif.xml
+++ b/erts/doc/src/erl_nif.xml
@@ -778,11 +778,17 @@ typedef enum {
and return true, or return false if term is not an unsigned integer or is
outside the bounds of type unsigned long.
- intenif_has_pending_exception(ErlNifEnv* env)
+ intenif_has_pending_exception(ErlNifEnv* env, ERL_NIF_TERM* reason)
Check if an exception has been raised.
Return true if a pending exception is associated
- with the environment env. The only possible exception is currently
- badarg (see enif_make_badarg).
+ with the environment env. If reason is a null pointer, ignore it.
+ Otherwise, if there's a pending exception associated with env, set the ERL_NIF_TERM
+ to which reason points to the value of the exception's term. For example, if
+ enif_make_badarg is called to set a
+ pending badarg exception, a subsequent call to enif_has_pending_exception(env, &reason)
+ will set reason to the atom badarg, then return true.
+ See also: enif_make_badarg.
+
intenif_inspect_binary(ErlNifEnv* env, ERL_NIF_TERM bin_term, ErlNifBinary* bin)
Inspect the content of a binary
--
cgit v1.2.3