Add failure scenarios tests for connection, appendToStream, deleteStream (wip)

This commit is contained in:
Nicolas Dextraze
2016-03-11 15:55:27 -08:00
parent b0a0af536d
commit 0b63df85e7
16 changed files with 420 additions and 32 deletions

View File

@ -0,0 +1,12 @@
var util = require('util');
function AccessDeniedError(action, stream) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = util.format("%s access denied for stream '%s'.", action, stream);
this.action = action;
this.stream = stream;
}
util.inherits(AccessDeniedError, Error);
module.exports = AccessDeniedError;

View File

@ -0,0 +1,11 @@
var util = require('util');
function StreamDeletedError(stream) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = util.format("Event stream '%s' is deleted.", stream);
this.stream = stream;
}
util.inherits(StreamDeletedError, Error);
module.exports = StreamDeletedError;

View File

@ -0,0 +1,13 @@
var util = require('util');
function WrongExpectedVersionError(action, stream, expectedVersion) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = util.format("%s failed due to WrongExpectedVersion. Stream: %s Expected version: %d.", action, stream, expectedVersion);
this.action = action;
this.stream = stream;
this.expectedVersion = expectedVersion;
}
util.inherits(WrongExpectedVersionError, Error);
module.exports = WrongExpectedVersionError;