Skip to content

Commit

Permalink
Added ignore statements to if/else-paths in log messages or for debug…
Browse files Browse the repository at this point in the history
… logs.
  • Loading branch information
Rekhyt committed Jan 27, 2019
1 parent 0be1536 commit 12c07bb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CommandDispatcherLocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class CommandDispatcherLocal {
*/
async dispatch (command) {
if (!this._subscriptions[command.name]) {
/* istanbul ignore next */
this._logger.error(new Error(`No handler for incoming command: ${command.name || 'no name given'}`))
return
}
Expand Down
2 changes: 2 additions & 0 deletions src/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class Entity {
*/
handle (command) {
if (!this._commandHandlerFunctions[command.name]) {
/* istanbul ignore next */
this.logger.error(new Error(`Cannot handle incoming command ${command.name || 'no name given'}.`))
return []
}
Expand All @@ -101,6 +102,7 @@ class Entity {
*/
apply (event) {
if (!this._eventHandlerFunctions[event.name]) {
/* istanbul ignore next */
this.logger.error(new Error(`Cannot apply incoming event ${event.name || 'no name given'}.`))
return []
}
Expand Down
2 changes: 2 additions & 0 deletions src/EventDispatcherEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class EventDispatcherEventEmitter extends EventEmitter {
if (save) await this._repository.save(event)

if (!this.emit(`${this._eventPrefix}/event/${event.name}`, event)) {
/* istanbul ignore next */
this._logger.error(new Error(`No handlers for incoming event: ${event.name || 'no name given'}`))
}
}
Expand All @@ -44,6 +45,7 @@ class EventDispatcherEventEmitter extends EventEmitter {
* @returns {Promise<void>}
*/
async publishMany (events, save) {
/* istanbul ignore else */
if (events) this._logger.debug({ events: JSON.stringify(events) }, 'Incoming events')

await Promise.all(events.map(async event => this.publish(event, save)))
Expand Down
3 changes: 3 additions & 0 deletions src/EventDispatcherLocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class EventDispatcherLocal {
if (save) await this._repository.save(event)

if (!this._subscriptions[event.name]) {
/* istanbul ignore next */
this._logger.error(new Error(`No handlers for incoming event: ${event.name || 'no name given'}`))
return
}
Expand All @@ -44,7 +45,9 @@ class EventDispatcherLocal {
* @returns {Promise<void>}
*/
async publishMany (events, save) {
/* istanbul ignore else */
if (events) this._logger.debug({ events: JSON.stringify(events) }, 'Incoming events')

await Promise.all(events.map(async event => this.publish(event, save)))
}

Expand Down
1 change: 1 addition & 0 deletions src/ReadModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ReadModel {
*/
async apply (event) {
if (!this._eventHandlerFunctions[event.name]) {
/* istanbul ignore next */
this.logger.error(new Error(`Cannot apply incoming event ${event.name || 'no name given'}.`))
return
}
Expand Down

0 comments on commit 12c07bb

Please sign in to comment.