rust/hg-core/src/lib.rs
changeset 44304 2fe89bec8011
parent 44303 d42eea9a0494
child 44305 d8d4fa9a7f18
--- a/rust/hg-core/src/lib.rs	Thu Jan 16 10:28:40 2020 +0100
+++ b/rust/hg-core/src/lib.rs	Thu Jan 16 11:27:12 2020 +0100
@@ -121,6 +121,9 @@
     UnsupportedSyntaxInFile(String, String, usize),
     TooLong(usize),
     IO(std::io::Error),
+    /// Needed a pattern that can be turned into a regex but got one that
+    /// can't. This should only happen through programmer error.
+    NonRegexPattern(IgnorePattern),
 }
 
 impl ToString for PatternError {
@@ -140,6 +143,9 @@
             }
             PatternError::IO(e) => e.to_string(),
             PatternError::Path(e) => e.to_string(),
+            PatternError::NonRegexPattern(pattern) => {
+                format!("'{:?}' cannot be turned into a regex", pattern)
+            }
         }
     }
 }