Exceptions and How to Handle Them

Learn about exceptions and how to handle them using the try/catch block.

Exception handling is an elegant way to handle errors beyond the program’s scope. For example, if our application fails to contact the database, we use exception handling to contact another data source or to provide instructions to the users that they need to contact technical support.

To better understand exception handling and why it’s useful, let’s see what happens when a program is fed faulty data.

Get hands-on with 1200+ tech skills courses.