-
Notifications
You must be signed in to change notification settings - Fork 15
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
meaningful error messages #1419
base: main
Are you sure you want to change the base?
Conversation
Print the real error message immediately.
f"{e}" | ||
) | ||
logger.warn( | ||
f"Trying again in {delay}s. Tried {i + 1} times so far..." |
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.
What about
f"{e}" | |
) | |
logger.warn( | |
f"Trying again in {delay}s. Tried {i + 1} times so far..." | |
f"{msg} - Caused by {e.__class__.__name__}: {e}. Trying again in {delay}s. Tried {i + 1} times so far..." |
to include the message?
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.
I think showing a general msg
for a catch all errors will be misleading more often than it is right. Therefore, I think e
should be printed. If you also want msg
go ahead, I am ok with that.
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.
The point could be to inform the user what is currently not working - sometimes the 'normal' error messages are not helpful and it might be good to say something about the funcion which did not work like ' Connecting to database failed: {e.class.name: {e}. Will retry ....'. I.e. I also would change the message to not be a error message :)
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.
The (not explicitly documented) intent for the function is to silence a specific, known exception temporarily. That's why msg
is printed and not the exception itself, because the assumption is that the calling code expects this exception to happen sometimes. It sounds like in your case, we catch too broadly, so I think a better fix is to narrow errors
where ever the error originates in your case.
It sounds more likely that |
The error class captured and thrown is |
Why do you replace the real error message with a custom message that does not know what happened?
pyiron_base/pyiron_base/utils/error.py
Line 148 in 0a6c4bb
Example:
FATAL: password authentication failed for user "seibll"
is reported asWARNING - Database busy with too many connections. Trying again in 0.1s. Tried 1 times so far...
The real error message is only shown after all retries have failed.
Suggesting to print it immediately.