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
def catch_general_exception(self,ex):
return isinstance(ex,Exception)
@retry(retry_on_exception=catch_general_exception)
def do_some_code:
# do some code
try:
# some ode
except Exception as ex:
passing catch_general_exception is not accepted even i passed self.catch_general_exception
The text was updated successfully, but these errors were encountered:
class SomeClass:
def catch_general_exception(self, ex):
return isinstance(ex,Exception)
@retry(retry_on_exception=self.catch_general_exception)
def do_some_code(self):
# do some code
try:
# some ode
except Exception as ex:
raise
This won't work because self isn't defined when the @retry decorator is being created.
This should work, though:
def catch_general_exception(ex):
return isinstance(ex,Exception)
class SomeClass:
@retry(retry_on_exception=catch_general_exception)
def do_some_code(self):
# do some code
try:
# some ode
except Exception as ex:
raise
This might even work: @retry(retry_on_exception=lamba ex: isinstance(ex, Exception)
Hello,
trying the following code is not working
passing catch_general_exception is not accepted even i passed self.catch_general_exception
The text was updated successfully, but these errors were encountered: