I don’t know what we can do with a custom exception, what we can’t do with a built-in one. It seems a naive question but I really have no idea about that.
What do you think?
I don’t know what we can do with a custom exception, what we can’t
Share
The reason for the different types of exceptions is to allow you to be able to catch just the ones you want with your handlers, letting the others go on up the stack. So you can arrange to catch exceptions for certain, occasionally-expected situations just by the type of the exception.
You may not need to create your own very often at all, actually. But if you do, it would be because you need to be able to throw and capture an exception type more specific than what is available, and perhaps with additional information attached.