Often times, though, if you want to throw an exception, you will want to use some custom Exception subclass, so you can identify the type of exception later on.

Exception is an ordinary class. You can create subclasses and throw instances of them, instead of throwing instances of Exception, as you see fit.

You can learn more about this in:
Run Edit