I think the correct way is to wrap any code block, that is likely to produce any exception, with try and catch. For example, if you are connecting to MongoDB you should wrap that piece of code in a try/catch to make sure you are able to handle connection errors.
try{
//Connect to MongoDB or write any risky code
}
catch(Exception $e){
echo $e.getMessage();
//print stack trace or do some action
}
If you need to handle 404 errors you can do something like this :
$router->notFound(array(
"controller" => "Controller",
"action" => "handle404"
));
The following link may give you more insight : docs.phalconphp.com/en/latest/reference/debug.html