UPDATE: Adds name validation and exposes it in wasm

We do a trick I am not proud of. Because all of our errors are Strings,
we don't have a way to separate a name error from an index error,
for instance. What I do in prepend the error with a string that indicates
where it comes from.
This commit is contained in:
Nicolás Hatcher
2025-11-17 19:57:18 +01:00
committed by Nicolás Hatcher Andrés
parent 3db094c956
commit 1391f196b5
7 changed files with 108 additions and 49 deletions

View File

@@ -775,4 +775,17 @@ impl Model {
.get_first_non_empty_in_row_after_column(sheet, row, column)
.map_err(to_js_error)
}
#[wasm_bindgen(js_name = "isValidDefinedName")]
pub fn is_valid_defined_name(
&self,
name: &str,
scope: Option<u32>,
formula: &str,
) -> Result<(), JsError> {
match self.model.is_valid_defined_name(name, scope, formula) {
Ok(_) => Ok(()),
Err(e) => Err(to_js_error(e.to_string())),
}
}
}