Throwing an Exception (and a Party)

Video loading...

Transcript language code: 

Join Drupalize.Me to watch this video

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

Log in Sign up
  • 0:07
    Let's talk about something totally different.
  • 0:10
    A powerful part of object-oriented code called Exceptions.
  • 0:15
    In index.php we create a BrokenShip object.
  • 0:19
    I'm going to do something crazy guys,
  • 0:22
    I'm going to say BrokenShip->setStrength
  • 0:27
    and pass it banana.
  • 0:30
    That strength makes no sense.
  • 0:32
    You cannot measure anything in bananas.
  • 0:36
    And if we try to battle using this ship,
  • 0:38
    we should get some sort of error.
Loading ...