From dd27dfb99e078819d60c99fcdb9cdf46101100ad Mon Sep 17 00:00:00 2001 From: Davide Bettio Date: Sat, 17 Aug 2024 13:03:39 +0200 Subject: [PATCH] Add support (as stub) for `erlang:error/3` Args and Options parameters are ignored, since the required machinery to support them is missing. Signed-off-by: Davide Bettio --- CHANGELOG.md | 1 + src/libAtomVM/nifs.c | 2 ++ src/libAtomVM/nifs.gperf | 1 + 3 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f3ea72e0..df9c353a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ require depending on default function and bootloader code - Support for Elixir `MapSet` module - Support for Elixir `Range` module - Support for Elixir `Kernel.min` and `Kernel.max` +- Support (as stub) for `erlang:error/3` (that is required from Elixir code) ## [0.6.3] - 20-07-2024 diff --git a/src/libAtomVM/nifs.c b/src/libAtomVM/nifs.c index 250c309ea..0c1b1c6b0 100644 --- a/src/libAtomVM/nifs.c +++ b/src/libAtomVM/nifs.c @@ -3250,6 +3250,8 @@ static term nif_erlang_garbage_collect(Context *ctx, int argc, term argv[]) return TRUE_ATOM; } +// TODO: WORKAROUND: this function also implements erlang:error/3, but it ignores Args and Options +// since we don't have required machinery to make use of them static term nif_erlang_error(Context *ctx, int argc, term argv[]) { UNUSED(argc); diff --git a/src/libAtomVM/nifs.gperf b/src/libAtomVM/nifs.gperf index 0ca7ffc6d..a39aa12bd 100644 --- a/src/libAtomVM/nifs.gperf +++ b/src/libAtomVM/nifs.gperf @@ -50,6 +50,7 @@ erlang:delete_element/2, &delete_element_nif erlang:erase/1, &erase_nif erlang:error/1, &error_nif erlang:error/2, &error_nif +erlang:error/3, &error_nif erlang:exit/1, &exit_nif erlang:exit/2, &exit_nif erlang:display/1, &display_nif