]> Repositorios git - scryer-prolog.git/commitdiff
throw permission_error when non-input stream is read
authorThierry Marianne <[email protected]>
Mon, 15 Sep 2025 06:28:23 +0000 (08:28 +0200)
committerThierry Marianne <[email protected]>
Mon, 15 Sep 2025 06:28:23 +0000 (08:28 +0200)
Signed-off-by: Thierry Marianne <[email protected]>
src/machine/machine_state.rs

index a3c141e099d3b309b6ead9059d9b799188f314e8..26ba9a69765a83584dde8cf9f92ec60d27ec53b4 100644 (file)
@@ -766,7 +766,16 @@ impl MachineState {
                 indices,
                 MachineState::read_term_from_user_input_eof_handler,
             ),
-            _ => Err(functor_stub(atom!("read_term_from_user_input"), 3)),
+            _ => {
+                let stub = functor_stub(atom!("read_term_from_user_input"), 3);
+                let err = self.permission_error(
+                    Permission::InputStream,
+                    atom!("stream"),
+                    atom_as_cell!(atom!("user_input")),
+                );
+
+                Err(self.error_form(err, stub))
+            }
         }
     }