Throwing Exceptions

Throwing Exceptions

You can throw exceptions anywhere in the program to artificially create an occurrence of an error. Additionally, you can create custom messages if you don't like the default message of…