aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/caldav/request/abstract.js3
-rw-r--r--lib/caldav/request/errors.js8
-rw-r--r--lib/caldav/xhr.js13
3 files changed, 7 insertions, 17 deletions
diff --git a/lib/caldav/request/abstract.js b/lib/caldav/request/abstract.js
index eb6297b..7116217 100644
--- a/lib/caldav/request/abstract.js
+++ b/lib/caldav/request/abstract.js
@@ -65,8 +65,7 @@
};
// in the future we may stream data somehow
- req.send(function xhrResult() {
- var xhr = req.xhr;
+ req.send(function xhrResult(err, xhr) {
if (xhr.status > 199 && xhr.status < 300) {
// success
self.sax.close();
diff --git a/lib/caldav/request/errors.js b/lib/caldav/request/errors.js
index c3c166e..700cfba 100644
--- a/lib/caldav/request/errors.js
+++ b/lib/caldav/request/errors.js
@@ -16,26 +16,26 @@
default:
message = this.code;
}
-
Error.call(this, message);
}
+
CaldavHttpError.prototype = {
__proto__: Error.prototype,
constructor: CaldavHttpError
}
-
+
// Unauthenticated error for
// Google Calendar
function UnauthenticatedError() {
var message = "Wrong username or/and password";
Error.call(this, message);
}
-
+
UnauthenticatedError.prototype = {
__proto__: Error.prototype,
constructor: UnauthenticatedError
}
-
+
module.exports = {
CaldavHttpError: CaldavHttpError,
UnauthenticatedError: UnauthenticatedError
diff --git a/lib/caldav/xhr.js b/lib/caldav/xhr.js
index abeae79..230f656 100644
--- a/lib/caldav/xhr.js
+++ b/lib/caldav/xhr.js
@@ -58,15 +58,6 @@
},
/**
- * Aborts request if its in progress.
- */
- abort: function abort() {
- if (this.xhr) {
- this.xhr.abort();
- }
- },
-
- /**
* @param {String} user basic auth user.
* @param {String} password basic auth pass.
* @return {String} basic auth token.
@@ -96,8 +87,6 @@
xhr = new this.xhrClass();
}
- this.xhr = xhr;
-
// This hack is in place due to some platform
// bug in gecko when using mozSystem xhr
// the credentials only seem to work as expected
@@ -154,6 +143,8 @@
this.waiting = true;
xhr.send(this._seralize());
+
+ return xhr;
}
};