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

implement isOurError() #376

Merged
merged 3 commits into from
Oct 18, 2019
Merged

implement isOurError() #376

merged 3 commits into from
Oct 18, 2019

Conversation

tjenkinson
Copy link
Contributor

Which provides a way of determining if the rejection from fire() or call() is from the circuit breaker or the action.

E.g

breaker.fire().catch((e) => {
  if (CircuitBreaker.isOurError(e)) {
    // the system is overloaded
  } else {
    // unexpected error
  }
});

Which provides a way of determining if the rejection from `fire()` or `call()` is from the circuit breaker or the action.
Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Thank you for the contribution.

@node-deno-dev
Copy link

Hi, what are some of the scenarios where the circuit breaker itself will be in an "error" state? For example: I see logs like "Breaker is open" when isOurError() is true.

You mention at the top of this page: if (CircuitBreaker.isOurError(e)) {
// the system is overloaded - when exactly does this happen?
} else {
// unexpected error
}

Thanks in advance.

@lance
Copy link
Member

lance commented Jun 5, 2020

@node-deno-dev if the circuit is open or shut down, or if function execution times out, or if the function's volume threshold has been exceeded the error is considered to have been generated internally - in the circuit breaker itself. Otherwise, the error was the function execution throwing an exception. HTH

@node-deno-dev
Copy link

Thank you Lance for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants