-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow dependency errors to pass through #13113
Allow dependency errors to pass through #13113
Conversation
Signed-off-by: Jacek Kusnierz <[email protected]>
Signed-off-by: Jacek Kusnierz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing to Synapse!
As far as I can tell there's one bit that's missing from your PR:
Lines 45 to 50 in 493c2fc
try: | |
import jwt | |
jwt # To stop unused lint. | |
except ImportError: | |
raise ConfigError(MISSING_JWT) |
Which still raises a ConfigError
instead of a DependencyException
. I believe this one can be fixed by replacing this block with:
check_requirements("jwt")
(and removing the then unused MISSING_AUTHLIB
constant)
Thanks for this: these changes are exactly what I had in mind. |
Co-authored-by: Brendan Abolivier <[email protected]>
I'm not sure how to perform check_requirements function on the authlib (which replaced jwt): can you point me to a documentation about how is it checked? |
#13113 (review) explains what needs to be done. In a little more detail:
|
Signed-off-by: Jacek Kusnierz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me apart from this, sorry for not explaining my previous comment enough (and thanks David for jumping in)!
synapse/config/jwt.py
Outdated
Install by running: | ||
pip install synapse[jwt] | ||
""" | ||
from ..util.check_dependencies import check_requirements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from ..util.check_dependencies import check_requirements | |
from synapse.util.check_dependencies import check_requirements |
When modules aren't in the current directory we usually prefer if the import path is absolute :)
This will need linting (because github's suggestions apparently don't allow me to move the import statement a line above 🙁 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now, thanks for your contribution! 🙂
Fixes #13066.
I think this was the author meant in the original issue: I'm not exactly sure how to grab the jwt one though, please advise.
Also mypy threw an error on my side which I do not understand: is there something missing? When removing try/catch the potentially exception-raising part is not visible well.
Signed-off-by: Jacek Kusnierz [email protected]
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)