Not knowing exactly what error handlers are in PHP I will look at this from a python point of view
In python we have exceptions, they are by name exceptional. We throw exceptions when something goes wrong or we are expecting something else or even we just want to fail. Exceptions can be thrown at any point, and then later caught for example
a = 'int'
b = int(a)
Will throw an exception because you cannot convert 'int' to an int, so now to do this with exception handling
try:
b = int("int")
except ValueError:
print "can't do that"
Now you notice we swallow the exception and carry on execution of the program, this isn't always the best idea, sometimes we might want to raise our own exception and crash
class NotADecimalNumber(Exception): pass
try:
b = int("a")
except ValueError:
raise NotADecimalNumber("'a' is not a decimal number idiot.")
Now we get our custom exception with a custom message