diff --git a/crates/generate/src/generate.rs b/crates/generate/src/generate.rs index 0551bb1d..cf6d1009 100644 --- a/crates/generate/src/generate.rs +++ b/crates/generate/src/generate.rs @@ -505,7 +505,6 @@ fn load_js_grammar_file(grammar_path: &Path, js_runtime: Option<&str>) -> JSResu .wait_with_output() .map_err(|e| JSError::IO(format!("Failed to read output from `{js_runtime}` -- {e}")))?; match output.status.code() { - None => panic!("`{js_runtime}` process was killed"), Some(0) => { let stdout = String::from_utf8(output.stdout).map_err(|e| JSError::JSRuntimeUtf8 { runtime: js_runtime.to_string(), @@ -533,6 +532,10 @@ fn load_js_grammar_file(grammar_path: &Path, js_runtime: Option<&str>) -> JSResu runtime: js_runtime.to_string(), code, }), + None => Err(JSError::JSRuntimeExit { + runtime: js_runtime.to_string(), + code: -1, + }), } } diff --git a/lib/binding_rust/lib.rs b/lib/binding_rust/lib.rs index 23506e03..5e0381bb 100644 --- a/lib/binding_rust/lib.rs +++ b/lib/binding_rust/lib.rs @@ -351,7 +351,7 @@ impl From for CaptureQuantifier { ffi::TSQuantifierZeroOrMore => Self::ZeroOrMore, ffi::TSQuantifierOne => Self::One, ffi::TSQuantifierOneOrMore => Self::OneOrMore, - _ => panic!("Unrecognized quantifier: {value}"), + _ => unreachable!(), } } }