Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return error from invocation when error filter filtered errors #567

Merged
merged 1 commit into from Apr 15, 2021

Commits on Apr 15, 2021

  1. fix: return errors from invocation filtered errors

    This commit reverts some of the behavior changes in
    nodeshift#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 nodeshift#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: nodeshift#564
    
    Signed-off-by: Lance Ball <lball@redhat.com>
    lance committed Apr 15, 2021
    Copy the full SHA
    c7793fb View commit details
    Browse the repository at this point in the history