A
A
Alexander Bondarenko2021-11-08 12:39:40
Django
Alexander Bondarenko, 2021-11-08 12:39:40

How can you catch errors from other libraries in celery?

Hello everyone, who knows how to properly catch errors in celery, I have try except, but I get an error

TypeError: catching classes that do not inherit from BaseException is not allowed

How can I handle these errors without conflict with celery?
try:
   await client_new(UpdateUsernameRequest(username=new_username))
   updated = True
except (UsernameOccupiedError, UsernameInvalidError):
   updated = False

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alternativshik, 2021-11-08
@bond_1013

show full code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question