Example #1
0
    }
    switch ($e->getStatusCode()) {
        case 404:
            $viewer = new Syonix\LogViewer\LogViewer($app['config']['logs']);
            return $app['twig']->render('error/log_file_not_found.html.twig', array('clients' => $viewer->getClients(), 'current_client_slug' => null, 'current_log_slug' => null, 'error' => $e));
        default:
            try {
                $viewer = new Syonix\LogViewer\LogViewer($app['config']['logs']);
                $clients = $viewer->getClients();
            } catch (\Exception $e) {
                $clients = array();
            }
            return $app['twig']->render('error/error.html.twig', array('clients' => $clients, 'clientSlug' => null, 'logSlug' => null, 'message' => 'Something went wrong!', 'icon' => 'bug', 'error' => $e));
    }
});
$app->error(function (\Exception $e, $code) use($app) {
    if ($app['debug']) {
        return;
    }
    switch ($code) {
        default:
            try {
                $viewer = new Syonix\LogViewer\LogViewer($app['config']['logs']);
                $clients = $viewer->getClients();
            } catch (\Exception $e) {
                $clients = array();
            }
            return $app['twig']->render('error/error.html.twig', array('clients' => $clients, 'clientSlug' => null, 'logSlug' => null, 'message' => 'Something went wrong!', 'icon' => 'bug', 'error' => $e));
    }
});
$app->run();