data-point icon indicating copy to clipboard operation
data-point copied to clipboard

Log paths to reducers that throw errors

Open raingerber opened this issue 7 years ago • 0 comments

Problem description:

It's hard to track the source of errors that are thrown from reducers.

Suggested solution:

When a reducer throws an error, we should log a path to the reducer that failed. After this message is printed, the error itself should be logged.

Example:

{
  // this entity combines a few different reducer types
  'hash:a': {
    value: [
      () => ({}),
      {
        a: {
          b: () => {
            throw Error()
          }
        }
      }
    ]
  }
}

If you execute the hash:a entity, it should log a message like this:

The following reducer failed to execute:
hash:a[value] -> ReducerList[1] -> ReducerObject[a.b] -> ReducerFunction

The exact wording could be different, but the message should make it easy to find which reducer actually failed.

raingerber avatar Jan 12 '18 20:01 raingerber