Add failure scenarios tests for connection, appendToStream, deleteStream (wip)
This commit is contained in:
12
src/errors/accessDeniedError.js
Normal file
12
src/errors/accessDeniedError.js
Normal 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;
|
11
src/errors/streamDeletedError.js
Normal file
11
src/errors/streamDeletedError.js
Normal 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;
|
13
src/errors/wrongExpectedVersionError.js
Normal file
13
src/errors/wrongExpectedVersionError.js
Normal 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;
|
Reference in New Issue
Block a user