From dc495f10f8469700bc90e9f8ab30b2a8c5f9cc0a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bennet=20Ble=C3=9Fmann?= Date: Sat, 26 Jul 2025 13:14:29 +0200 Subject: [PATCH] change behaviour in supposedly unreachable cases --- src/machine/machine_errors.rs | 9 +++++++++ src/machine/system_calls.rs | 9 ++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/machine/machine_errors.rs b/src/machine/machine_errors.rs index fec32ddd..084c8a83 100644 --- a/src/machine/machine_errors.rs +++ b/src/machine/machine_errors.rs @@ -601,6 +601,15 @@ impl MachineState { } } + pub(super) fn unreachable_error(&self) -> MachineError { + let stub = functor!(atom!("system_error")); + + MachineError { + stub, + location: None, + } + } + #[cfg(feature = "ffi")] pub(super) fn ffi_error(&self, err: FFIError) -> MachineError { let error_atom = match err { diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index a1eb15be..214c6d3a 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -8680,6 +8680,7 @@ impl Machine { self.machine_st.throw_resource_error(resource_err_loc); } } + Ok(()) } else { #[cfg(unix)] { @@ -8697,16 +8698,18 @@ impl Machine { self.machine_st.throw_resource_error(resource_err_loc); } } + Ok(()) } else { - unify!(self.machine_st, status_r, atom_as_cell!(atom!("unknown"))); + let err = self.machine_st.unreachable_error(); + Err(self.machine_st.error_form(err, stub_gen())) } } #[cfg(not(unix))] { - unify!(self.machine_st, status_r, atom_as_cell!(atom!("unknown"))); + let err = self.machine_st.unreachable_error(); + Err(self.machine_st.error_form(err, stub_gen())) } } - Ok(()) } Err(_) => { let perm_error = self.machine_st.permission_error( -- 2.54.0