Skip to content

Commit

Permalink
Merge pull request #1246 from bettio/make-erlang-error-3-work
Browse files Browse the repository at this point in the history
Stub `erlang:error/3` for Elixir support

Stub function used from certain Elixir versions.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
  • Loading branch information
bettio committed Aug 17, 2024
2 parents 35a2527 + dd27dfb commit f6b7143
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/libAtomVM/nifs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/libAtomVM/nifs.gperf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f6b7143

Please sign in to comment.