fixup error handling

This commit is contained in:
Ryan Heywood 2025-07-12 14:34:00 -04:00
parent 68326174f7
commit b3a16d49bc
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ use system::dmesg;
fn main() { fn main() {
if let Err(e) = init() { if let Err(e) = init() {
dmesg(format!("Error: {e}")); dmesg(format!("Error: {e}"));
let mut opt = Some(&e as &dyn std::error::Error); let mut opt = std::error::Error::source(&e);
while let Some(current_source) = opt { while let Some(current_source) = opt {
dmesg(format!("Caused by: {current_source}")); dmesg(format!("Caused by: {current_source}"));
opt = current_source.source(); opt = current_source.source();
@ -28,7 +28,7 @@ fn init() -> Result<()> {
if let Err(errors) = system::mount_default_targets() { if let Err(errors) = system::mount_default_targets() {
for error in errors { for error in errors {
dmesg(format!("Error while mounting: {error}")); dmesg(format!("Error while mounting: {error}"));
let mut opt = Some(&error as &dyn std::error::Error); let mut opt = std::error::Error::source(&error);
while let Some(current_source) = opt { while let Some(current_source) = opt {
dmesg(format!("Caused by: {current_source}")); dmesg(format!("Caused by: {current_source}"));
opt = current_source.source(); opt = current_source.source();
@ -65,7 +65,7 @@ fn init() -> Result<()> {
*/ */
} }
config::Mode::Exec => { config::Mode::Exec => {
dmesg("pivoting to {command}"); dmesg(format!("pivoting to {command}"));
system::syscall::execv(command, &[])?; system::syscall::execv(command, &[])?;
} }
} }