aboutsummaryrefslogtreecommitdiffstats
path: root/src/run/builtin.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/run/builtin.rs')
-rw-r--r--src/run/builtin.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/run/builtin.rs b/src/run/builtin.rs
index f3682f7..fd4cbed 100644
--- a/src/run/builtin.rs
+++ b/src/run/builtin.rs
@@ -1116,13 +1116,18 @@ mod dbg {
let regex = match crate::parse::regex::Pattern::parse_from_bytes(&args[0]) {
Ok(r) => r,
Err(e) => {
- writeln!(stdout, "not a valid regex: {e:?}")?;
+ writeln!(stdout, "parse error: {e:?}")?;
return Err(Error::Exit(1));
},
};
- let compiled = regex.compile();
- writeln!(stdout, "{compiled:?}")?;
+ match regex.try_compile() {
+ Ok(compiled) => writeln!(stdout, "{compiled:?}")?,
+ Err(e) => {
+ writeln!(stdout, "compilation error: {e:?}")?;
+ return Err(Error::Exit(2));
+ },
+ }
Ok(())
}