Remove redundant error-to-string fn (#288)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,3 +25,4 @@ yarn-error.log*
|
|||||||
# rust
|
# rust
|
||||||
src/wasm-lib/target
|
src/wasm-lib/target
|
||||||
public/wasm_lib_bg.wasm
|
public/wasm_lib_bg.wasm
|
||||||
|
src/wasm-lib/lcov.info
|
||||||
|
|||||||
@ -27,9 +27,3 @@ pub struct KclErrorDetails {
|
|||||||
#[serde(rename = "msg")]
|
#[serde(rename = "msg")]
|
||||||
pub message: String,
|
pub message: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<KclError> for String {
|
|
||||||
fn from(error: KclError) -> Self {
|
|
||||||
serde_json::to_string(&error).unwrap()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1575,7 +1575,7 @@ extern "C" {
|
|||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn parse_js(js: &str) -> Result<JsValue, String> {
|
pub fn parse_js(js: &str) -> Result<JsValue, String> {
|
||||||
let tokens = lexer(js);
|
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
|
// The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the
|
||||||
// gloo-serialize crate instead.
|
// gloo-serialize crate instead.
|
||||||
JsValue::from_serde(&program).map_err(|e| e.to_string())
|
JsValue::from_serde(&program).map_err(|e| e.to_string())
|
||||||
|
|||||||
Reference in New Issue
Block a user