Step 2: How to Handle an Exception (Literally Throw It)

Step 2: The exception is thrown, and now you're left with a mess.

Don't worry, it's not a bug, it's just an What Is an Exception trying to make its big entrance.

When the exception is thrown, the program is like, "Oh no, what have you done?!" and it's up to you to clean up the mess.

So, here's what you do:

  1. Try to catch it, like a ball in a game of catch.
  2. If you can't catch it, just let it fly and hope it doesn't hit anything important.
  3. Or, if all else fails, just pretend it never happened and hope the user doesn't notice.

Next Step: How to Handle an Unexpected Situation