diff options
author | James Lal <james@lightsofapollo.com> | 2012-06-26 12:41:13 +0200 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2012-06-26 12:41:13 +0200 |
commit | 95d50ef280c46ce6a29454285ccd7fc42cbcac61 (patch) | |
tree | c9516585ef17fdf00228b1c8533c5d2fa1c88a3a /lib/webcals | |
parent | 10900e01370c1fd4d147168cdc30ed81a77dcf44 (diff) | |
download | jsCalDAV-95d50ef280c46ce6a29454285ccd7fc42cbcac61.tar.gz |
Add process result so we can have cleaner propfind results
Diffstat (limited to 'lib/webcals')
-rw-r--r-- | lib/webcals/request/abstract.js | 4 | ||||
-rw-r--r-- | lib/webcals/request/propfind.js | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/webcals/request/abstract.js b/lib/webcals/request/abstract.js index c90b960..de159b6 100644 --- a/lib/webcals/request/abstract.js +++ b/lib/webcals/request/abstract.js @@ -51,7 +51,7 @@ return ''; }, - _processResult: function(callback, req) { + _processResult: function(req, callback) { callback.call(this, null, this.sax.root, req); }, @@ -73,7 +73,7 @@ if (xhr.status > 199 && xhr.status < 300) { // success self.sax.write(xhr.responseText).close(); - self._processResult(callback, req); + self._processResult(req, callback); } else { // fail callback(new Error('http error code: ' + xhr.status)); diff --git a/lib/webcals/request/propfind.js b/lib/webcals/request/propfind.js index 9e06b49..d73530c 100644 --- a/lib/webcals/request/propfind.js +++ b/lib/webcals/request/propfind.js @@ -42,6 +42,18 @@ _createPayload: function() { var content = this.template.tag('prop', this._props.join('')); return this.template.render(content); + }, + + _processResult: function(req, callback) { + if ('multistatus' in this.sax.root) { + callback(null, this.sax.root.multistatus, req); + } else { + //XXX: Improve error handling + callback( + new Error('unexpected xml result'), + this.sax.root, req + ); + } } }; |