Skip to content

Attribute Error should be caught in backends base exception #5435

Merged
auvipy merged 1 commit into
celery:masterfrom
cdknorow:features/attribute_error
Apr 28, 2019
Merged

Attribute Error should be caught in backends base exception #5435
auvipy merged 1 commit into
celery:masterfrom
cdknorow:features/attribute_error

Conversation

@cdknorow

@cdknorow cdknorow commented Apr 3, 2019

Copy link
Copy Markdown
Contributor

Celery looks for exceptions in sys.modules and catches a keyerror if it doesn't exist. However, it is also possible that it finds the exec_module but finds the wrong one. In this case an Attribute Error gets raised. It would be nice if celery caught that exception and created a custom exception class that correctly propogates the error message instead of raising a new one.

@cdknorow cdknorow changed the title Attribute Error should be caught when celery fails to find the correc… Attribute Error should be caught in backends base exception Apr 3, 2019
@cdknorow

cdknorow commented Apr 3, 2019

Copy link
Copy Markdown
Contributor Author

this solves an issue I'm seeing where django db models is raising a DoesNotExist exception, but when celery tries to reraise this exception on the backend, it is finding a different module which doesn't have the DoesNotExist attribute.

@auvipy

auvipy commented Apr 3, 2019

Copy link
Copy Markdown
Member

can you add a small test for this?

@cdknorow

cdknorow commented Apr 3, 2019

Copy link
Copy Markdown
Contributor Author

@auvipy done

@auvipy

auvipy commented Apr 4, 2019

Copy link
Copy Markdown
Member

thanks, will come back after making the master stable

@auvipy
auvipy merged commit b17278a into celery:master Apr 28, 2019
nijel added a commit to WeblateOrg/docker that referenced this pull request Sep 8, 2019
cdknorow added a commit to cdknorow/celery that referenced this pull request Oct 7, 2019
jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants