Browse Source

more robust error handling

master
mort 8 years ago
parent
commit
fdfe627445
2 changed files with 8 additions and 3 deletions
  1. 7
    2
      client.js
  2. 1
    1
      package.json

+ 7
- 2
client.js View File

@@ -20,6 +20,10 @@
xhr.addEventListener("error", function(err) {
cb(err);
});
xhr.addEventListener("abort", function(err) {
console.log("Aborted.");
cb(err);
});

xhr.open("POST", url);
xhr.send();
@@ -59,9 +63,10 @@
}

function await() {
console.log("await...");
post("/webevents/await/"+key, function(err, res) {
console.log("Await done,", err ? "with errors" : "no errors");
if (err) {
console.log("Await done, with errors");
}

// Retry on error
if (err === "ENOTREGISTERED") {

+ 1
- 1
package.json View File

@@ -1,6 +1,6 @@
{
"name": "webevents",
"version": "1.1.1",
"version": "1.1.2",
"description": "A simple library for sending events from the server to the client.",
"main": "index.js",
"scripts": {

Loading…
Cancel
Save