You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it would be nice if function is_system_error can work with self._exceptions as well. I am about to implement ES circuit breaker for just one exception (ES BROKEN CONNECTION) so that I have to create my own Breaker (subclassing CircuitBreaker) and rewrite function is_system_error instead of just define one exception in the new list self._exceptions.
Regards,
Vojtech.
The text was updated successfully, but these errors were encountered:
Yes, I needed something similar and ended up using a callable that check that the error is of the type i want. But that functionality is only in the latest master, not in a release
Now that some time has passed, it's simple to do this as sebastiandev has said
Including a test for this here, modeled after the existing tests in tests.py:
deftest_allow_whitelist(self):
"""CircuitBreaker: it should allow the user to add a predicate function to determine excluded exceptions. """acceptableExceptions= [NotImplementedError]
isUnacceptableException=lambdae: type(e) notinacceptableExceptionsself.breaker=CircuitBreaker(exclude=[isUnacceptableException])
defthrowsAcceptableError(): raiseNotImplementedErrordefthrowsUnacceptableError(): raiseLookupErrorself.assertRaises(NotImplementedError, self.breaker.call, throwsAcceptableError)
self.assertEqual(1, self.breaker.fail_counter)
self.assertRaises(LookupError, self.breaker.call, throwsUnacceptableError)
self.assertEqual(0, self.breaker.fail_counter)
Also this issue seems to be a copy of #5, so probably one of them should be closed?
Hi All,
it would be nice if function
is_system_error
can work withself._exceptions
as well. I am about to implement ES circuit breaker for just one exception (ES BROKEN CONNECTION) so that I have to create my own Breaker (subclassing CircuitBreaker) and rewrite functionis_system_error
instead of just define one exception in the new listself._exceptions
.Regards,
Vojtech.
The text was updated successfully, but these errors were encountered: