mirror of
https://github.com/zkemail/zk-regex.git
synced 2026-01-09 13:48:00 -05:00
fix: handle parse errors
This commit is contained in:
@@ -19,8 +19,13 @@ pub fn genFromDecomposed(
|
||||
) -> Result<String, JsValue> {
|
||||
let mut decomposed_regex_config: DecomposedRegexConfig =
|
||||
serde_json::from_str(decomposedRegexJson).expect("failed to parse decomposed_regex json");
|
||||
let regex_and_dfa = get_regex_and_dfa(&mut decomposed_regex_config)
|
||||
.expect("failed to convert the decomposed regex to dfa");
|
||||
let regex_and_dfa = get_regex_and_dfa(&mut decomposed_regex_config).map_err(|e| {
|
||||
JsValue::from_str(&format!(
|
||||
"failed to convert the decomposed regex to dfa: {}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
|
||||
gen_circom_string(®ex_and_dfa, circomTemplateName)
|
||||
.map_err(|e| JsValue::from_str(&format!("Failed to generate Circom string: {}", e)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user