Skip to content

Commit

Permalink
added error page with detailed information about the error
Browse files Browse the repository at this point in the history
  • Loading branch information
adanda committed May 26, 2012
1 parent 92b5496 commit 49f899c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Cips/Projects/Project.php
Expand Up @@ -677,7 +677,7 @@ public function build($app)
*/
protected function generateComposedOutput($cmd, $output)
{
$composed_output = '$ '.$cmd."\n\r";
$composed_output = '$ '.$cmd."\n\r\n\r";
$composed_output .= $output."\n\r\n\r";

return $composed_output;
Expand Down
8 changes: 7 additions & 1 deletion src/app.php
Expand Up @@ -12,10 +12,16 @@
*/

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

$app->error(function(Exception $e) use ($app)
{
return $app->redirect('/');
return new Response(
$app['twig']->render('error.html.twig', array(
'error' => $e
)),
500
);
});


Expand Down
12 changes: 12 additions & 0 deletions views/error.html.twig
@@ -0,0 +1,12 @@
{% extends 'layout.html.twig' %}

{% block content %}
<br/><br/><br/>
Error in {{ error.getFile }} on Line {{ error.getLine }}:<br/><br/>
{{ error.getMessage }}
<br/><br/>
{{ error.getTraceAsString|replace({'\n':'<br/>'})|raw }}
{% for trace in error.getTrace %}
{{ trace.function }}
{% endfor %}
{% endblock %}
5 changes: 5 additions & 0 deletions web/js/main.js
Expand Up @@ -32,6 +32,11 @@ function buildProject($project_slug)
$('#loader_build').hide();
$('#builds_list').children().first().after($html);
$('#builds_list li').animate({opacity: 1}, 2000);
},
error: function($request, $error){
document.open();
document.write($request.responseText);
document.close();
}
});
}

0 comments on commit 49f899c

Please sign in to comment.