Try-catch

Try-catch is a PHP command, which run a block of code, and catch some configured exceptions that the block may throw. It may be completed with a finally block.

The catch clause may be anonymous, when it only specify the type of caught exception, without providing a variable name.

<?php

try {
    callSomeMethod();
} catch (\Exception $e) {
    // process the error here
}

?>

Documentation

See also PHP: Try and Catch me if you can!, How to Implement Try Catch Finally Blocks in PHP

Related : Finally