catch
block.
If an exception is not caught, a fatal error will be issued with an Uncaught Exception
message.
Proper exception code should include:
Try
:
A function using an exception should be in a try
block.
If the exception does not trigger, the code will continue as normal.
However if the exception triggers, an exception is “thrown.”
Throw
:
This is how you trigger an exception.
Each throw
must have at least one catch
.
Catch
:
A catch
block retrieves an exception and creates an object containing the exception information.
Hedgehogs – why can’t they just share the hedge? — Dan Antolpolski |