Skip to content

Crash and error fixes - #64

Open
UncleGrumpy wants to merge 5 commits into
atomvm:masterfrom
UncleGrumpy:crash_and_error_fixes
Open

Crash and error fixes#64
UncleGrumpy wants to merge 5 commits into
atomvm:masterfrom
UncleGrumpy:crash_and_error_fixes

Conversation

@UncleGrumpy

Copy link
Copy Markdown
Collaborator

Prevent some avoidable crashes in API calls. Fix early exits in API calls, allowing errors to propagate to applications to allow graceful error reporting and exit at the applications discretion. Throw an error when writing the avm file fails, rather than silently absorb the error, misleading users to believe the operation was successful.

Fix get_flags/1 undefined crash by adding default value 0, this will allow
`is_beam/1` and `is_entrypoint/1` to return `false` rather than crash on
malformed or unrecognized files.

Signed-off-by: Winford <winford@object.stream>
@UncleGrumpy
UncleGrumpy force-pushed the crash_and_error_fixes branch from 27307ec to 0e17161 Compare July 25, 2026 05:28
Add default [] to get_imports/1 and get_atoms/1.

Signed-off-by: Winford <winford@object.stream>
Use structured tuple `{no_start_module_found, ParsedFiles}` in `prune/2` for
error reporting.

Signed-off-by: Winford <winford@object.stream>
Propagate write errors in write_packbeam/2, return {error, {write_failed, ...}}
instead of silently swallowing the error.

Signed-off-by: Winford <winford@object.stream>
Replace exit/1 with throw/1 in get_parsed_file/2 to prevent early VM
termination, and allow error to be reported.

Signed-off-by: Winford <winford@object.stream>
@UncleGrumpy
UncleGrumpy force-pushed the crash_and_error_fixes branch from 0e17161 to 66c7f0a Compare July 25, 2026 05:31
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