Open Luthaf opened 5 years ago
Introducing rascal specific exception allow C++ users of the library to handle these exceptions separately from std::exception
if they want, and since they inherit from std::exception
they will be caught in a catch (const std::exception& e)
arm.
Sure, sounds like a good idea in principle.
This spawn up from a comment by @max-veit, that some exceptions should never be triggered, because the parameter combination should have been handled elsewhere. The message associated with these exceptions should make that clear, like in
https://github.com/cosmo-epfl/librascal/blob/deb7a09bed3e8713267a364cd742687eb28aaa8c/src/representations/calculator_spherical_expansion.hh#L1028-L1039
One possible way to fix this is to introduce rascal specific exception types:
And then use
rascal::internal_error
for, well, internal errors, andrascal::error
for other cases. Other sub-classes can be introduced as needed.Then, as a further step, a macro can be introduced to capture local info for debug variables, backtrace, etc.