Skip to content

Commit

Permalink
Improve error message oriented from JS object
Browse files Browse the repository at this point in the history
`JsValue.as_string` converts the value to String iff the value is a
String itself, so the error message always failovers to empty string.
`JsValue` impls `Debug` using `JSON.stringify`, and it gives better
description of the error.
  • Loading branch information
kateinoigakukun committed Mar 27, 2022
1 parent a8a3412 commit 7adcfef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C

## **Unreleased**

### Fixed
- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object.

## 2.2.1 - 2022/03/15

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/js/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl fmt::Display for RuntimeErrorSource {
match self {
Self::Generic(s) => write!(f, "{}", s),
Self::User(s) => write!(f, "{}", s),
Self::Js(s) => write!(f, "{}", s.as_string().unwrap_or("".to_string())),
Self::Js(s) => write!(f, "{:?}", s),
}
}
}
Expand Down

0 comments on commit 7adcfef

Please sign in to comment.