Add catch(console.error) to all examples

Some examples have been failing to load in some browsers, and this
ensures that whenever the promise to load Rust code fails we log any
errors happening instead of accidentally failing silently.

This helped debug a bit in #897
This commit is contained in:
Alex Crichton
2018-09-28 13:54:29 -07:00
parent 11bcaf42d5
commit bc36b6f84b
15 changed files with 91 additions and 69 deletions

View File

@ -1,4 +1,6 @@
// For more comments about what's going on here, check out the `hello_world`
// example
const rust = import('./add');
rust.then(m => alert('1 + 2 = ' + m.add(1, 2)));
rust
.then(m => alert('1 + 2 = ' + m.add(1, 2)))
.catch(console.error);