uibcdf / MolSysMT

Open source library to work with molecular systems
https://www.uibcdf.org/MolSysMT/
Other
12 stars 3 forks source link

Exceptions report more information #79

Closed Daniel-Ibarrola closed 2 years ago

Daniel-Ibarrola commented 2 years ago

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