Skip to content

Improve panic handling#751

Merged
vinc merged 9 commits intotrunkfrom
feature/panic
Jun 27, 2025
Merged

Improve panic handling#751
vinc merged 9 commits intotrunkfrom
feature/panic

Conversation

@vinc
Copy link
Owner

@vinc vinc commented Jun 23, 2025

I found that I could improve the panic handlers while working on error messages for the brainfuck interpreter in #750

@vinc
Copy link
Owner Author

vinc commented Jun 23, 2025

Panic in userspace:

~
> hello panic
Error: Panicked

@vinc
Copy link
Owner Author

vinc commented Jun 23, 2025

Panic inside the kernel:

~
> panic kernel panic
Error: Panicked at src/usr/shell.rs:567:23
       ^^^^^^^^ kernel panic

@vinc
Copy link
Owner Author

vinc commented Jun 23, 2025

Trying to execute a tiny file (less than 4 bytes) would previously crash the kernel:

~
> print no => /tmp/no

~
> /tmp/no
Error: Panicked at src/sys/process.rs:363:15
       ^^^^^^^^ range end index 4 out of range for slice of length 3

Now the kernel just returns an error:

~
> /tmp/no
Error: Could not execute '/tmp/no'

@vinc
Copy link
Owner Author

vinc commented Jun 23, 2025

Screenshot:

panic

@vinc vinc marked this pull request as ready for review June 27, 2025 20:14
@vinc vinc merged commit f977c77 into trunk Jun 27, 2025
1 check passed
@vinc vinc deleted the feature/panic branch June 27, 2025 20:15
@vinc vinc mentioned this pull request Sep 20, 2025
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