Closed jschroth closed 2 weeks ago
You should be able to simplify this down to:
def should_retry(exception: Exception) -> bool:
match exception:
case SlackApiError():
return exception.response["error"] not in SlackAPIErrorCode.__members__.values()
case TimeoutError() | Timeout():
return True
case _:
return False
We could also implement __contains__
on DispatchEnum
to allow exception.response["error"] not in SlackAPIErrorCode
Does not retry for any item in the SlackAPIErrorCode enum