Closed jerome-ai closed 3 years ago
I have made changes in the same branch. So most of the Exceptions were replaced with ValueError. I created custom exceptions (such as ConfigException, ABMAException) for some of the other Exceptions. Replaced all such Exceptions being raised.
There are numerous places where the base Exception class is either raised or caught; a quick search of master:
In places where it's caught (
except
), it's dangerous because you have no way of differentiating the error that took place: any exception could have been thrown and it's going to be dealt with in the same way when the catcher probably had a certain error in mind. In places where it's raised (raise
), it doesn't give the caller any information about what they should do.The ideal case would be to have a
CovidModellingException
class, and a few classes that are children of it that get thrown. An easier case would be to thrown concrete builtin exceptions (ValueError
orAttributeError
) for example.