We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d250917 commit fa073e4Copy full SHA for fa073e4
include/fine.hpp
@@ -409,9 +409,15 @@ template <> struct Decoder<bool> {
409
template <> struct Decoder<ErlNifPid> {
410
static ErlNifPid decode(ErlNifEnv *env, const ERL_NIF_TERM &term) {
411
ErlNifPid pid;
412
- if (!enif_get_local_pid(env, term, &pid)) {
+ if (!enif_is_pid(env, term)) {
413
throw std::invalid_argument("decode failed, expected a local pid");
414
}
415
+ if (!enif_get_local_pid(env, term, &pid)) {
416
+ // If the term is a PID and it is not local, it means it's a remote PID.
417
+ throw std::invalid_argument(
418
+ "decode failed, expected a local pid, but got a remote one. NIFs can "
419
+ "only send messages to local PIDs and remote PIDs cannot be decoded");
420
+ }
421
return pid;
422
423
};
0 commit comments