Handle exceptions from JSON::stringify

This commit is contained in:
Andrew Chin
2018-08-10 14:10:51 -04:00
parent 23cb0ea656
commit f5203bba8a
3 changed files with 30 additions and 4 deletions

View File

@ -2683,8 +2683,8 @@ extern "C" {
/// specified.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
#[wasm_bindgen(static_method_of = JSON)]
pub fn stringify(obj: &JsValue) -> JsString;
#[wasm_bindgen(catch, static_method_of = JSON)]
pub fn stringify(obj: &JsValue) -> Result<JsString, JsValue>;
}