Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't hide exceptions #21

Open
TalShor opened this issue Feb 11, 2024 · 1 comment
Open

Don't hide exceptions #21

TalShor opened this issue Feb 11, 2024 · 1 comment

Comments

@TalShor
Copy link

TalShor commented Feb 11, 2024

try:
importlib.import_module("smart_open")
except:
print("smart_open not installed, please pip install smart-open")

Hides the actual exception - I had a pyOpenSSL issue with smart_open (just a version issue) and it took me 10 minutes to understand where is it from.

either do raise Exception post print - or even just print it.
but this is something that's a show stopper - so just let it crash.

@alondmnt
Copy link
Contributor

I agree. usually what we try to do is something like this:

....
except Exception as e:
    if self.errors == 'raise':
        raise(e)
    elif self.errors == 'warn':
        warnings.warn(f'Error joining research_stage: {e}')

and for importing I think that we can try to handle with 'pip install' and then a repeated import (which can then fail).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants