I'm creating a function and want it to be able to give meaningful error message whenever it encounter an error.
I would like to ask whether this situation is a proper use of custom exception, and if not what is appropriate way to handle it.
Example :
int res = a - b;
if (res < 0)
throw new MyCustomeExp("Invalid input. 'a' should be larger than 'b'.");
Does using custom exception for such purpose is proper ?
Thank you.