It would be beneficial to create more custom exception types. Currently TypeError and ValueError are used multiple places. When using this in downstream projects, these exception types are very broad, and might catch unintentional exceptions. If one wants to catch a specific exception, one has to match the exception error string, which IMO is quite hacky.
These custom does not need to be very advanced, simply defining it as a new exception that is a subclass of e.g TypeError or ValueError would be sufficient, and they should be exposed to the users so they can import these exception classes in their downstream package if they want. I think this will be a non-breaking change as well, since a subclass B of class A is still of type A.
Examples of custom exceptions could be:
NotSymmetricalMatrixError, NotPositiveDefiniteError, MatrixShapeError
It would be beneficial to create more custom exception types. Currently
TypeErrorandValueErrorare used multiple places. When using this in downstream projects, these exception types are very broad, and might catch unintentional exceptions. If one wants to catch a specific exception, one has to match the exception error string, which IMO is quite hacky.These custom does not need to be very advanced, simply defining it as a new exception that is a subclass of e.g
TypeErrororValueErrorwould be sufficient, and they should be exposed to the users so they can import these exception classes in their downstream package if they want. I think this will be a non-breaking change as well, since a subclass B of class A is still of type A.Examples of custom exceptions could be:
NotSymmetricalMatrixError,NotPositiveDefiniteError,MatrixShapeError