Skip to content

Conversation

@bettio
Copy link
Collaborator

@bettio bettio commented Nov 7, 2025

See also #1951

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

RAISE()/RAISE_ERROR() is more maintainable than directly writing to registers.

Signed-off-by: Davide Bettio <[email protected]>
@bettio bettio force-pushed the error-handling-rework branch 2 times, most recently from c1e0a45 to 85dce1e Compare November 11, 2025 12:38
Just use the ones defined in nifs.h.

Signed-off-by: Davide Bettio <[email protected]>
@bettio bettio force-pushed the error-handling-rework branch from 85dce1e to c8e8d05 Compare November 11, 2025 18:46
…fields

Store exception information in context fields:
- exception_class (was `x[0]` register)
- exception_reason (was `x[1]` register)
- exception_stacktrace (was `x[2]` register).

This avoids overwriting function arguments when raising an error,
allowing better diagnostic, also this should allow the fix of atomvm#1951 and
proposes an alternative approach to atomvm#1804.

Also, simplify stacktrace_build(): it requires just Context * parameter.

Signed-off-by: Davide Bettio <[email protected]>
@bettio bettio force-pushed the error-handling-rework branch from c8e8d05 to e8830d4 Compare November 11, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant