diff options
author | James Lal <james@lightsofapollo.com> | 2013-05-10 17:25:19 -0700 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2013-05-10 17:25:19 -0700 |
commit | 456913dc8b057cc44df753223e31800da62d8e98 (patch) | |
tree | d1accd27e745c36ecbe80f94375b49bc3b1b8646 /lib/caldav/request | |
parent | 9b5dd29c45ea08ff362198ffb984492df1ebadb1 (diff) | |
download | jsCalDAV-456913dc8b057cc44df753223e31800da62d8e98.tar.gz |
Rework http error validation so it can be reused r=kgrandon
Diffstat (limited to 'lib/caldav/request')
-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; |