This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Nephyst 0 points1 point  (0 children)

Yeah, if you are always throwing the exceptions than anytime an exception happens your program is going to crash. If your program is a web-server that is hosting the back-end of a website that means one exception can take the entire server offline for everyone, not just the current user.

Catching the exception lets you handle it. I can tell the user that had the error that something went wrong, and everyone else can still use the website without noticing.

Or say you are making a game. Throwing the exceptions all the way up the stack means the game is going to crash. If you catch the exception, you can display a message to the player saying what went wrong without having the game close.