Different Exception Classes

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:07
    Catching an exception is really powerful,
  • 0:10
    but you can get even fancier.
  • 0:13
    For right now, var_dump the exception object.
  • 0:16
    OK, this object is actually a PDOException.
  • 0:21
    2 important things, all exceptions are objects,
  • 0:25
    and all exception classes ultimately extend PHP's base exception class.
  • 0:32
    So if you could look at the source code for PDOException,
  • 0:35
    you'd see that it extends exception.
  • 0:38
    And this ends up giving us a lot more flexibility when working with exceptions.
  • 0:43
    Why?
Loading ...