Error handling with exceptions


show more Error handling with exceptions provides you with in-depth training on Developer. Taught by Jon Peck as part of the Object-Oriented Programming with PHP show less
please wait ...

Error handling with exceptions

Exception handling is an object- oriented way of responding to abnormal or exceptional situations that can change program flow. Practically speaking, this means avoiding crashing. When there is serious fault, PHP creates what's known as an exception, which is a problem that needs to be dealt with. When an exception is created, it's thrown, which is kind of like telling everybody that there is a problem. To handle an exception, somebody must catch it, which means someone is listening, and dealt with the problem. To prepare for this, I need to surround the code that can throw an exception with a try block, followed by a catch.

This is like me saying, "Let me try to do this action, and if it doesn't work, then I'll deal with the problem." If an exception is thrown and not caught, the program crashes. Not cool. Exceptions are good, as they are a much nicer and logical way of dealing with problems. Instead of just stopping or displaying an error, I've got a chance to...

Error handling with exceptions
Video duration: 2m 6s 1h 57m Intermediate Updated Apr 10, 2013

Viewers:

Error handling with exceptions provides you with in-depth training on Developer. Taught by Jon Peck as part of the Object-Oriented Programming with PHP

Subject:
Developer
Software:
PHP
Author:
please wait ...