-
Notifications
You must be signed in to change notification settings - Fork 5
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 no-key error message in ase target parser #242
Conversation
I don't think this is what we want for #194. I constantly see very bad error messages when not using |
Can you give another example? This PR is improving the error message you saw. What would you like to have for example for this error? |
Sure:
The point is that IMO cutting out the stack trace is a bad choice, at least at this point in the development of metatrain. Sure, if we become famous with thousands of users and we have 20 developers, then we can have a custom 1-line error for everything. But for now, I would keep the stack trace |
I mean this looks like some issues inside the bpnn. I disagree. If you are not a developer giving a traceback doesn't really help. I mean how often do you read the traceback of a compiler error and you have no idea what is going on. But, I am open to discuss. |
Why don't we just remove the custom handling of errors for now? These errors are crap |
We could take inspiration on sphinx, and save the whole tracback to a file, and show the path to the file in the user-facing error message. Something like
We could also try to include the last line of the error, although this won't be helpful most of the time as we see |
Also a good idea. However, we already have log file which contains the same as the stdout/stderr and opening another might be too much? We can however to an output log and an error log, where the latter contains the error including the traceback... After talking to @frostedoyster, I suggest the following logging.error(
f"{traceback.format_exc()}\n"
"If the error message below is unclear, please help us improve it by "
"opening an issue at https://github.com/lab-cosmo/metatrain/issues. "
"Thank you!\n\n"
f"{err}") This will log the error message to stdout and file on the bottom which is directly visible to the user; Above an info helping us improving the message and above the traceback. This would look like for the current issue.
What do you think? |
Ok, I would save the stack trace to a file (very good idea) and remove it from the logs, where we can have the last line + the suggestion of "if this is unclear, please report it, help improve it and include the full error at <error_file>" |
Thanks for your feedback. The current output is $ mtt train foo
the @Luthaf had a good idea adding the |
a4134f1
to
44e8732
Compare
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 great, thank you very much @PicoCentauri
Fixes #194
The default ase error message of unknown keys is very unhelpful for us. I improved the error message for ase readers. With these options
The error is
Contributor (creator of pull-request) checklist
📚 Documentation preview 📚: https://metatrain--242.org.readthedocs.build/en/242/