I’m writing a program that will perform matrix operations, and I’m trying to figure out what kind of exeption I should use in case of invalid dimensions. Is there some exception type that already exists that would be acceptable for my operations to throw; or should I implement my own exception type? I know that pretty much any exception type would do what I want, but the issue is making sure that the exception actually describes the problem that caused it.
I’m writing a program that will perform matrix operations, and I’m trying to figure
Share
The closest fit for what you are looking for is the
IndexOutOfBoundsException. You can use it as-is, or derive your ownMatrixIndexOutOfBoundsExceptionexception from it.