Exceptions

Core defines some exception classes to be used as helpers. These exceptions should be catched in base application entry point or somewhere like that. System will not handle them.

Example from web/app.php:

try {
    ...
} catch (Exception $e) {
    $code = $e->getCode();
    if ($code < 100) {
        $code = 500;
    }
    if ($kernel->format == 'json') {
        json_exception($e, $code);
    } else {
        html_exception($e, $code);
    }
}

function json_exception($e, $code) {
    /* output json exception content */
}

function html_exception($e, $code) {
    /* output html exception content */
}

Classes