I’ve created my own exception to handle situations like arithmetic exceptions, and other situation involving mathematic rules. But When I call it never goes to my Exception for example,on division by zero goes to arithmetic exception instead
I’ve created my own exception to handle situations like arithmetic exceptions, and other situation
Share
Division by zero and other “standard” arithmetic errors are handled by the runtime or the class library, which don’t know about your user defined exception. You can only use your own exceptions in your own code by explcitly
throwing them when it is appropriate.Of course, it is possible to catch any arithmetic exceptions thrown by the class library and wrap them into your own exceptions: