-
Notifications
You must be signed in to change notification settings - Fork 101
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
Improve error message #1556
Improve error message #1556
Conversation
…area and thickness from the flowline
Is the new notebook part of this PR intentionally? |
Yes, that does make sense. However I don't think I fully understand you suggestion. What do you mean with name property? Thanks for noticing the notebook, that was not supposed to be included in this PR. |
ModuleNotFoundError inherits the name property from the ImportError Exception class. You'll also most definitely want to add an else-Branch to that if that re-raises the exception, otherwise this could hide other errors and continue despite the loading having failed. |
Thanks for the explanation @TimoRoth! Is the latest commit what you had in mind? |
To re-raise an exception, just call One more issue I could see is that by creating a new ModuleNotFoundError without the name/path argument set, you might be breaking conventions. What you could do instead: if err.name == "shapely.io":
err.msg = "You need shapely version 2.0 or higher for this to work."
raise |
Thanks for the coding lesson. That looks indeed better :) |
Thanks! |
This PR addresses issue #1555, by improving the error message that is being raised for the following error
ModuleNotFoundError: No module named 'shapely.io'
.