This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from michalbe/error-handler
error handler
- Loading branch information
Showing
11 changed files
with
159 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ node_modules | |
data/ | ||
vendor/ | ||
sandbox/ | ||
.gitignore | ||
test/servers/servers.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
(function(module, ns) { | ||
|
||
function CaldavHttpError(code) { | ||
this.code = code; | ||
var message; | ||
switch(this.code) { | ||
case 401: | ||
message = 'Wrong username or/and password'; | ||
break; | ||
case 404: | ||
message = 'Url not found'; | ||
break; | ||
case 500: | ||
message = 'Server error'; | ||
break; | ||
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 | ||
}; | ||
|
||
}.apply( | ||
this, | ||
(this.Caldav) ? | ||
[Caldav('request/errors'), Caldav] : | ||
[module, require('../caldav')] | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{"tests": [ | ||
"/test/caldav/connection_test.js","/test/caldav/index_test.js","/test/caldav/query_builder_test.js","/test/caldav/request/abstract_test.js","/test/caldav/request/asset_test.js","/test/caldav/request/calendar_home_test.js","/test/caldav/request/calendar_query_test.js","/test/caldav/request/propfind_test.js","/test/caldav/request/resources_test.js","/test/caldav/resources/calendar_test.js","/test/caldav/sax/base_test.js","/test/caldav/sax/calendar_data_handler_test.js","/test/caldav/sax/dav_response_test.js","/test/caldav/sax_test.js","/test/caldav/template_test.js","/test/caldav/xhr_test.js","/test/servers/calendar_home_test.js" | ||
"/test/caldav/connection_test.js","/test/caldav/index_test.js","/test/caldav/query_builder_test.js","/test/caldav/request/abstract_test.js","/test/caldav/request/asset_test.js","/test/caldav/request/calendar_home_test.js","/test/caldav/request/calendar_query_test.js","/test/caldav/request/propfind_test.js","/test/caldav/request/resources_test.js","/test/caldav/resources/calendar_test.js","/test/caldav/sax/base_test.js","/test/caldav/sax/calendar_data_handler_test.js","/test/caldav/sax/dav_response_test.js","/test/caldav/sax_test.js","/test/caldav/template_test.js","/test/caldav/xhr_test.js","/test/servers/home_test.js","/test/servers/query_test.js","/test/servers/resources_test.js" | ||
]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters