]> Repositorios git - scryer-prolog.git/commitdiff
switch invalid term from type to domain error
authorBennet Bleßmann <[email protected]>
Sun, 4 Aug 2024 13:16:37 +0000 (15:16 +0200)
committerBennet Bleßmann <[email protected]>
Mon, 5 Aug 2024 19:25:44 +0000 (21:25 +0200)
src/machine/machine_errors.rs
src/machine/machine_state.rs
tests/scryer/cli/src_tests/directive_errors.md

index cb4edba8bb1963b4a18b8880e6ba03b3c8130c97..9f22d0e3bd8a98e8bfcca292d1623bfbcf8be9cd 100644 (file)
@@ -38,7 +38,6 @@ pub(crate) enum ValidType {
     Callable,
     Character,
     Compound,
-    Directive,
     Evaluable,
     Float,
     InByte,
@@ -74,7 +73,6 @@ impl ValidType {
             //            ValidType::PredicateIndicator => atom!("predicate_indicator"),
             //            ValidType::Variable => atom!("variable")
             ValidType::TcpListener => atom!("tcp_listener"),
-            ValidType::Directive => atom!("directive"),
         }
     }
 }
index eecac17fb92b698f933c61cb5db2cc6b7d6da1fd..5376042cee4d8fccbc349f9d4b2f3df6d283f473 100644 (file)
@@ -981,8 +981,8 @@ impl MachineState {
 
     pub(crate) fn directive_error(&mut self, err: DirectiveError) -> MachineError {
         match err {
-            DirectiveError::ExpectedDirective(_term) => self.type_error(
-                ValidType::Directive,
+            DirectiveError::ExpectedDirective(_term) => self.domain_error(
+                DomainErrorType::Directive,
                 atom_as_cell!(atom!("todo_insert_invalid_term_here")),
             ),
             DirectiveError::InvalidDirective(name, arity) => {
index 95ed55a413ce5cfabf51d4dbae8bffda59602fb6..48b25fe05a67a0e9425c56b5e23c2200573a08a1 100644 (file)
@@ -30,7 +30,7 @@ $ scryer-prolog -f --no-add-history tests-pl/invalid_decl5.pl -g halt
 
 ```trycmd
 $ scryer-prolog -f --no-add-history tests-pl/invalid_decl6.pl -g halt
-   error(type_error(directive,todo_insert_invalid_term_here),load/1).
+   error(domain_error(directive,todo_insert_invalid_term_here),load/1).
 
 ```