-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Hi!
For example:
export = domain.defineEvent({}, (data, aggregate) => {
aggregate.set('balance', data.balance);
aggregate.set('value', data.value);
throw new FakeError(); // unhandled, something went wrong or TypeError
});
how to handle such type of errors?
Approach listed below doesn't help.
async handle(data: object) {
return new Promise((resolve, reject) => {
try {
this.domain.handle(data, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
} catch (e) {
reject(e);
}
});
}
This problem is similar for defineViewBuilder of eventdenormalizer. Can't catch errors there too.
another a little question:
Why custom command handler is so bad?
Command Handler (Be careful!!!)
Is your use case not solvable without a custom command handling? Sagas? Micro-Services?
what if I need to make external operation like 3rd party API http call and generate event with resulted data without saving to eventstore. This event then can be handled by sagas to generate command to update required aggregate.
Metadata
Metadata
Assignees
Labels
No labels