thenativeweb / node-cqrs-eventdenormalizer

Node-cqrs-eventdenormalizer is a node.js module that implements the cqrs pattern. It can be very useful as eventdenormalizer component if you work with (d)ddd, cqrs, domain, host, etc.
http://cqrs.js.org/pages/eventdenormalizer.html
MIT License
38 stars 27 forks source link

Fix preExtendEvent callback errs param in dispatch func #79

Closed shazichuanshuo closed 5 years ago

shazichuanshuo commented 5 years ago

DESCRIPTION

The issue here is if there is error happened in the pre event extender, the callback will happen with param name err. However the code in the denormalizer dispatch func call it with [errs] which will cause ReferenceError.

STEPS

  1. Define an pre event extender as

    module.exports = require('cqrs-eventdenormalizer').definePreEventExtender({
    name: 'testCreated',
    aggregate: 'test',
    context: 'core'
    }, function(evt, col, callback) {
    callback(new Error('This is a test'), evt);;
    });
  2. Call the denormalizer dispatch

EXPECTED

Handle the error gracefully

OBSERVATIONS

"ReferenceError: errs is not defined.

adrai commented 5 years ago

very nice, thx

adrai commented 5 years ago

v1.16.2