Permalink
Browse files

make finish function usable in commandhandlers

  • Loading branch information...
1 parent 1c79f41 commit 2a33036e54b745b9e3a1b4f68ae416d0875371a3 Adriano Raiano committed Feb 22, 2013
Showing with 9 additions and 5 deletions.
  1. +8 −4 lib/bases/commandHandlerBase.js
  2. +1 −1 package.json
@@ -55,14 +55,18 @@ CommandHandler.prototype = {
// finally publish commandRejected event on error
function(err) {
- if (err) {
- eventEmitter.emit('commandRejected', cmd, err);
- }
- eventEmitter.emit('handled:' + cmd.command, id, cmd);
+ self.finish(id, cmd, err);
});
},
+ finish: function(id, cmd, err) {
+ if (err) {
+ eventEmitter.emit('commandRejected', cmd, err);
+ }
+ eventEmitter.emit('handled:' + cmd.command, id, cmd);
+ },
+
commit: function(cmd, aggregate, stream, callback) {
var self = this;
View
@@ -1,7 +1,7 @@
{
"author": "adrai",
"name": "cqrs-domain",
- "version": "0.3.6",
+ "version": "0.3.7",
"private": false,
"main": "index.js",
"engines": {

0 comments on commit 2a33036

Please sign in to comment.