[Courier] added errors for VersionConflicts and DocFetchFailures

This commit is contained in:
Spencer Alger 2014-02-18 09:25:49 -07:00
parent 77db7177b1
commit 99b510b174

View file

@ -1,5 +1,6 @@
define(function (require, module, exports) {
define(function (require) {
var listenerCount = require('utils/event_emitter').listenerCount;
var errors = {};
// caused by a refresh attempting to start before the prevous is done
function HastyRefresh() {
@ -8,5 +9,29 @@ define(function (require, module, exports) {
}
HastyRefresh.prototype = new Error();
HastyRefresh.prototype.constructor = HastyRefresh;
exports.HastyRefresh = HastyRefresh;
errors.HastyRefresh = HastyRefresh;
// where there is an error getting a doc
function DocFetchFailure(resp) {
this.name = 'DocFetchFailure';
this.resp = resp;
this.message = 'Failed to get the doc: ' + JSON.stringify(resp);
}
DocFetchFailure.prototype = new Error();
DocFetchFailure.prototype.constructor = DocFetchFailure;
errors.DocFetchFailure = DocFetchFailure;
// there was a conflict storing a doc
function VersionConflict(resp) {
this.name = 'VersionConflict';
this.resp = resp;
this.message = 'Failed to store document changes do to a version conflict.';
}
VersionConflict.prototype = new Error();
VersionConflict.prototype.constructor = VersionConflict;
errors.VersionConflict = VersionConflict;
return errors;
});