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

Exceptions report more information #79

Merged
merged 4 commits into from
Jul 8, 2022
Merged

Conversation

Daniel-Ibarrola
Copy link
Collaborator

When a MolSysMT exception is raised it reports the name of the method or function that raised it. Example:

import molsysmt as msm
msm.get(element="cow")

Traceback (most recent call last):
  ...

molsysmt._private.exceptions.value_errors.WrongElementError: Error in get. Wrong element name: cow. Check  for more information. If you still need help, open a new issue in https://github.com/uibcdf/MolSysMT/issues.

Exceptions make use of the inspect library to retrieve the name of the function that raised them. However, many of the functions check their arguments with a decorator and the name of the function is lost and cannot be retrieved with the inpsect library. To fix this, an optional argument "caller" was added to the exceptions as well as the digestion functions.

Also, NotImplementedConversionError was implemented as before.

Closes #61

@Daniel-Ibarrola Daniel-Ibarrola requested a review from dprada July 8, 2022 00:12
Copy link
Contributor

@dprada dprada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It is a pity that an extra 'caller' argument had to be added, but what matters is that you made it work.

I don't resign myself to thinking that this 'caller' argument could be avoided. Really inspect is not useful with the decorator? Let me open an issue to give me the chance in the future to think about it, even if you think that there is no other way to solve it 😜.

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

Successfully merging this pull request may close these issues.

Exceptions reporting more information
2 participants