Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: return errors from invocation filtered errors (#567)
This commit reverts some of the behavior changes in #556. In that PR, the intent was to avoid calling the fallback function when an an invocation error is filtered by a user supplied `errorFilter` function. It did accomplish that, however, it also changed how a function resolves in the case of a filtered error. Previously, even though the error was filtered, the function invocation would return the error to the caller. With #556, this changed so that the caller instead receives simply a truthy value. This commit reverts that behavior so that the error is returned. While it may seem counter intuitive to return an error when the it was filtered by a user supplied `errorFilter` function, there are good reasons to do so. It provides the caller with error information at the point of invocation instead of in an event listener which may be disconnected from the invocation code path. The purpose of `errorFilter` is simply to prevent filtered errors from causing the circuit to open. But the fact is that the function invocation failed, and providing this to the user at the point of failure is better usability in my opinion. Plus, it's what we've always been doing, and I think the change to returning a truthy value was really just a side effect of not calling the fallback function. My preference would be to minimize the breaking changes in 6.x, and this PR helps to accomplish that (albeit 6.0 will be a weird bump in the road). Fixes: #564 Signed-off-by: Lance Ball <lball@redhat.com>
- Loading branch information