diff options
author | James Lal <james@lightsofapollo.com> | 2013-05-10 17:33:00 -0700 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2013-05-10 17:33:00 -0700 |
commit | 09d9ad3f92edec992bd1ab2e6a1c505f16bf22de (patch) | |
tree | d8c5b306760c9de5359aafe428753a4f3326c7a5 /lib/caldav/request/abstract.js | |
parent | 9b5dd29c45ea08ff362198ffb984492df1ebadb1 (diff) | |
parent | 5f35b858c31d455894f3c700eade1d1ca0ca4d3a (diff) | |
download | jsCalDAV-09d9ad3f92edec992bd1ab2e6a1c505f16bf22de.tar.gz |
Merge pull request #17 from lightsofapollo/asset-http-status-checks
Rework http error validation so it can be reused r=kgrandon
Diffstat (limited to 'lib/caldav/request/abstract.js')
-rw-r--r-- | lib/caldav/request/abstract.js | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/lib/caldav/request/abstract.js b/lib/caldav/request/abstract.js index 6f33af4..acc91cc 100644 --- a/lib/caldav/request/abstract.js +++ b/lib/caldav/request/abstract.js @@ -2,20 +2,6 @@ var SAX = ns.require('sax'); var XHR = ns.require('xhr'); - var Errors = ns.require('errors'); - - function determineHttpStatusError(status) { - var message = 'Cannot handle request due to server response'; - var err = 'Unknown'; - - if (status === 500) - err = 'ServerFailure'; - - if (status === 401) - err = 'Authentication'; - - return new Errors[err](message); - } /** * Creates an (Web/Cal)Dav request. @@ -85,19 +71,8 @@ return callback(err); } - // handle the success case - if (xhr.status > 199 && xhr.status < 300) { - self.sax.close(); - return self._processResult(req, callback); - } - - // probable error cases - callback( - determineHttpStatusError(xhr.status), - xhr - ); - - + self.sax.close(); + return self._processResult(req, callback); }); return req; |