@orchestrated-io/cqrs-domain
Version:
Node-cqrs-domain is a node.js module based on node-eventstore. It can be very useful as domain component if you work with (d)ddd, cqrs, eventdenormalizer, host, etc.
28 lines (21 loc) • 760 B
JavaScript
// Grab the util module that's bundled with Node
var util = require('util');
// Create a new custom Error constructor
function AggregateConcurrencyError(msg, more) {
// Pass the constructor to V8's
// captureStackTrace to clean up the output
Error.captureStackTrace(this, AggregateConcurrencyError);
// If defined, store a custom error message
if (msg) {
this.message = msg;
}
// If defined, store more infos
if (more) {
this.more = more;
}
}
// Extend our custom Error from Error
util.inherits(AggregateConcurrencyError, Error);
// Give our custom error a name property. Helpful for logging the error later.
AggregateConcurrencyError.prototype.name = AggregateConcurrencyError.name;
module.exports = AggregateConcurrencyError;