Remove redundant error-to-string fn (#288)

This commit is contained in:
Adam Chalmers
2023-08-18 17:10:55 -05:00
committed by GitHub
parent 01f95d4ace
commit 6ea3a37e8a
3 changed files with 2 additions and 7 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ yarn-error.log*
# rust
src/wasm-lib/target
public/wasm_lib_bg.wasm
src/wasm-lib/lcov.info

View File

@ -27,9 +27,3 @@ pub struct KclErrorDetails {
#[serde(rename = "msg")]
pub message: String,
}
impl From<KclError> for String {
fn from(error: KclError) -> Self {
serde_json::to_string(&error).unwrap()
}
}

View File

@ -1575,7 +1575,7 @@ extern "C" {
#[wasm_bindgen]
pub fn parse_js(js: &str) -> Result<JsValue, String> {
let tokens = lexer(js);
let program = abstract_syntax_tree(&tokens).map_err(String::from)?;
let program = abstract_syntax_tree(&tokens).map_err(|e| e.to_string())?;
// The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the
// gloo-serialize crate instead.
JsValue::from_serde(&program).map_err(|e| e.to_string())