Adding transaction tests

This commit is contained in:
Nicolas Dextraze
2016-03-18 14:04:07 -07:00
parent a64dbc9b8e
commit b2504749ce
12 changed files with 626 additions and 351 deletions

View File

@ -1,10 +1,20 @@
var util = require('util');
var Long = require('long');
function StreamDeletedError(stream) {
function StreamDeletedError(streamOrTransactionId) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = util.format("Event stream '%s' is deleted.", stream);
this.stream = stream;
if (typeof streamOrTransactionId === 'string') {
this.message = util.format("Event stream '%s' is deleted.", streamOrTransactionId);
this.stream = streamOrTransactionId;
return;
}
if (Long.isLong(streamOrTransactionId)) {
this.message = util.format("Stream is deleted for transaction %s.", streamOrTransactionId);
this.transactionId = streamOrTransactionId;
return;
}
throw new TypeError("second argument must be a stream name or transaction Id.");
}
util.inherits(StreamDeletedError, Error);