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,11 +1,12 @@
const rust = import('./fetch');
rust
.then(m => {
m.run().then((data) => {
console.log(data);
rust.then(m => {
m.run().then((data) => {
console.log(data);
console.log("The latest commit to the wasm-bindgen %s branch is:", data.name);
console.log("%s, authored by %s <%s>", data.commit.sha, data.commit.commit.author.name, data.commit.commit.author.email);
})
});
console.log("The latest commit to the wasm-bindgen %s branch is:", data.name);
console.log("%s, authored by %s <%s>", data.commit.sha, data.commit.commit.author.name, data.commit.commit.author.email);
})
})
.catch(console.error);