generateResult(); echo $result; } catch (\Exception $err) { // catch all exceptions and let the controller generate the error $error = Controller\Controller::errorResult($err); // pass generated error result to output echo View\Main::generateOutput($error); }