From ed89c43e484918a045ec7433292772346ca896bc Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Sun, 24 Apr 2022 20:59:00 -0600 Subject: [PATCH] catch existence_error exceptions from top-level calls to attribute_goals/3 (#1432) --- src/machine/machine_state_impl.rs | 9 +-------- src/machine/project_attributes.pl | 1 + 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/machine/machine_state_impl.rs b/src/machine/machine_state_impl.rs index cbd8d602..5223dc92 100644 --- a/src/machine/machine_state_impl.rs +++ b/src/machine/machine_state_impl.rs @@ -1885,14 +1885,7 @@ impl MachineState { } (HeapCellValueTag::PStrLoc | HeapCellValueTag::PStrOffset, h) => { let (focus, _) = pstr_loc_and_offset(&self.heap, h); - let pstr_atom = read_heap_cell!(self.heap[focus], - (HeapCellValueTag::CStr | HeapCellValueTag::PStr, pstr_atom) => { - pstr_atom - } - _ => { - unreachable!() - } - ); + let pstr_atom = cell_as_atom!(self.heap[focus]); if has_tail { self.s = HeapPtr::PStrLocation(focus, offset); diff --git a/src/machine/project_attributes.pl b/src/machine/project_attributes.pl index ae2054e3..b2f75007 100644 --- a/src/machine/project_attributes.pl +++ b/src/machine/project_attributes.pl @@ -32,6 +32,7 @@ call_attribute_goals([Module|Modules], GoalCaller, AttrVars) :- '$print_attribute_goals_exception'(Module, E) :- ( E = error(evaluation_error((Module:attribute_goals)/3), attribute_goals/3) + ; E = error(existence_error(procedure, attribute_goals/3), attribute_goals/3) -> true ; loader:write_error(E), nl -- 2.54.0