diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php index 477d79a952..cf9ccca1d8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php @@ -24,11 +24,13 @@ class ExceptionController extends Controller /** * Converts an Exception to a Response. * - * @param ExceptionManager $manager An ExceptionManager instance + * @param ExceptionManager $manager An ExceptionManager instance + * @param string $format The format to use for rendering (html, xml, ...) + * @param Boolean $embedded Whether the rendered Response will be embedded or not * * @throws \InvalidArgumentException When the exception template does not exist */ - public function exceptionAction(ExceptionManager $manager, $format) + public function exceptionAction(ExceptionManager $manager, $format, $embedded = false) { $this['request']->setRequestFormat($format); @@ -43,6 +45,7 @@ class ExceptionController extends Controller 'manager' => $manager, 'managers' => $manager->getLinkedManagers(), 'currentContent' => $currentContent, + 'embedded' => $embedded, ) ); $response->setStatusCode($manager->getStatusCode()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css b/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css new file mode 100644 index 0000000000..28e9344ba6 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css @@ -0,0 +1,36 @@ +/* +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 3.1.2 +build: 56 +*/ +.sf-exceptionreset html{color:#000;background:#FFF;}.sf-exceptionreset body,.sf-exceptionreset div,.sf-exceptionreset dl,.sf-exceptionreset dt,.sf-exceptionreset dd,.sf-exceptionreset ul,.sf-exceptionreset ol,.sf-exceptionreset li,.sf-exceptionreset h1,.sf-exceptionreset h2,.sf-exceptionreset h3,.sf-exceptionreset h4,.sf-exceptionreset h5,.sf-exceptionreset h6,.sf-exceptionreset pre,.sf-exceptionreset code,.sf-exceptionreset form,.sf-exceptionreset fieldset,.sf-exceptionreset legend,.sf-exceptionreset input,.sf-exceptionreset textarea,.sf-exceptionreset p,.sf-exceptionreset blockquote,.sf-exceptionreset th,.sf-exceptionreset td{margin:0;padding:0;}.sf-exceptionreset table{border-collapse:collapse;border-spacing:0;}.sf-exceptionreset fieldset,.sf-exceptionreset img{border:0;}.sf-exceptionreset address,.sf-exceptionreset caption,.sf-exceptionreset cite,.sf-exceptionreset code,.sf-exceptionreset dfn,.sf-exceptionreset em,.sf-exceptionreset strong,.sf-exceptionreset th,.sf-exceptionreset var{font-style:normal;font-weight:normal;}.sf-exceptionreset li{list-style:none;}.sf-exceptionreset caption,.sf-exceptionreset th{text-align:left;}.sf-exceptionreset h1,.sf-exceptionreset h2,.sf-exceptionreset h3,.sf-exceptionreset h4,.sf-exceptionreset h5,.sf-exceptionreset h6{font-size:100%;font-weight:normal;}.sf-exceptionreset q:before,.sf-exceptionreset q:after{content:'';}.sf-exceptionreset abbr,.sf-exceptionreset acronym{border:0;font-variant:normal;}.sf-exceptionreset sup{vertical-align:text-top;}.sf-exceptionreset sub{vertical-align:text-bottom;}.sf-exceptionreset input,.sf-exceptionreset textarea,.sf-exceptionreset select{font-family:inherit;font-size:inherit;font-weight:inherit;}.sf-exceptionreset input,.sf-exceptionreset textarea,.sf-exceptionreset select{*font-size:100%;}.sf-exceptionreset legend{color:#000;} + +.sf-exceptionreset strong { font-weight: bold } +.sf-exceptionreset em { font-style: italic } +.sf-exceptionreset a { color: #333 } +.sf-exceptionreset abbr { border-bottom: 1px dotted #000000; cursor: help } +.sf-exceptionreset h1 { font-size: 170%; letter-spacing: -0.03em; } +.sf-exceptionreset h2 { margin-top: 4px; font-size: 90%; letter-spacing: -0.02em; } +.sf-exceptionreset h3 { font-size: 130%; font-weight: bold; letter-spacing: -0.02em; } +.sf-exceptionreset h3 span { float: right; font-size: 80%; background: #eee; color: #333; padding: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } +.sf-exceptionreset ul { padding-left: 20px } +.sf-exceptionreset ul li { padding-bottom: 5px; list-style: decimal } +.sf-exceptionreset ol { font-family: monospace; white-space: pre; padding: 10px 0 } +.sf-exceptionreset ol li { margin: -5px; list-style: decimal; list-style-position: inside } +.sf-exceptionreset ol .selected { font-weight: bold; background-color: #ffd; padding: 2px 0 } +.sf-exceptionreset p.error { padding: 10px; background-color: #f00; font-weight: bold; text-align: center; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } +.sf-exceptionreset p.error a { color: #fff } +.sf-exceptionreset .block { padding: 20px 25px; margin-bottom: 10px; border: 1px solid #ddd; background-color: #fff; text-align:left; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; min-width: 770px; max-width: 770px } +.sf-exceptionreset .traces { display: none; margin-top: 10px } +.sf-exceptionreset #message { margin-top: 30px; margin-bottom: 10px; padding: 20px 25px; border: 1px solid #ddd; text-align:left; background-color: #c8e8f3; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; min-width: 770px; max-width: 770px } +.sf-exceptionreset #content { border: 1px solid #ddd; margin-top: 10px; padding: 7px; overflow: auto; } +.sf-exceptionreset a.file_link { text-decoration: none; } +.sf-exceptionreset a.file_link:hover { text-decoration: underline; } +.sf-exceptionreset .code { overflow: auto; } +.sf-exceptionreset img { vertical-align: middle; } +.sf-exceptionreset .error { background-color: #f66 } +.sf-exceptionreset .linked ul, .sf-exceptionreset .linked li { padding-left: 0; display: inline } +.sf-exceptionreset .linked li { padding-right: 7px } +.sf-exceptionreset #logs { margin-top: 10px } diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.php index 958c7f2710..40b95c7d1f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.php @@ -1,84 +1,58 @@ - - - - - <?php echo htmlspecialchars($manager->getMessage(), ENT_QUOTES, $view->getCharset()) ?> (<?php echo $manager->getStatusCode() ?> <?php echo $manager->getStatusText() ?>) - - - - -
-
-
- +
+
+
+ +
+
+

formatFileFromText(str_replace("\n", '
', htmlspecialchars($manager->getMessage(), ENT_QUOTES, $view->getCharset()))) ?>

+

getStatusCode() ?> getStatusText() ?> - getName() ?>

+ +
linked Exception 1): ?>s: +
    + $previous): ?> +
  • + getName() ?> » +
  • + +
-
-

', htmlspecialchars($manager->getMessage(), ENT_QUOTES, $view->getCharset())) ?>

+ +
-

getStatusCode() ?> getStatusText() ?> - getName() ?>

- -
linked Exception 1): ?>s: -
    - $previous): ?> -
  • - getName() ?> » -
  • - -
-
- -
+
+
-
-
+ render('FrameworkBundle:Exception:traces', array('manager' => $manager, 'position' => 0, 'count' => count($managers))) ?> - render('FrameworkBundle:Exception:traces', array('manager' => $manager, 'position' => 0, 'count' => count($managers))) ?> + $previous): ?> + render('FrameworkBundle:Exception:traces', array('manager' => $previous, 'position' => $i + 1, 'count' => count($managers))) ?> + - $previous): ?> - render('FrameworkBundle:Exception:traces', array('manager' => $previous, 'position' => $i + 1, 'count' => count($managers))) ?> - +
+

+ countErrors()): ?> + countErrors() ?> errorcountErrors() > 1): ?>s + + Logs » +

-
-

- countErrors()): ?> - countErrors() ?> errorcountErrors() > 1): ?>s - - Logs » -

+ - +
-
+
+

Content of the Output »

-
-

Content of the Output »

+ - - -
-
-
- - +
+ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/layout.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/layout.php new file mode 100644 index 0000000000..81f9036a1d --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/layout.php @@ -0,0 +1,35 @@ + + + + + <?php echo htmlspecialchars($manager->getMessage(), ENT_QUOTES, $view->getCharset()) ?> (<?php echo $manager->getStatusCode() ?> <?php echo $manager->getStatusText() ?>) + + + + +
+ get('_content') ?> +
+ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/styles.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/styles.php index 90719625e0..2b35cb128e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/styles.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/styles.php @@ -1,41 +1 @@ -/* -Copyright (c) 2010, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.com/yui/license.html -version: 3.1.2 -build: 56 -*/ -html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;} - -/* -Symfony stylesheet -*/ -html { background: #eee } -body { font: 11px Verdana, Arial, sans-serif; color: #333 } -strong { font-weight: bold } -em { font-style: italic } -a { color: #333 } -abbr { border-bottom: 1px dotted #000000; cursor: help } -h1 { font-size: 170%; letter-spacing: -0.03em; } -h2 { margin-top: 4px; font-size: 90%; letter-spacing: -0.02em; } -h3 { font-size: 130%; font-weight: bold; letter-spacing: -0.02em; } -h3 span { float: right; font-size: 80%; background: #eee; color: #333; padding: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } -ul { padding-left: 20px } -ul li { padding-bottom: 5px; list-style: decimal } -ol { font-family: monospace; white-space: pre; padding: 10px 0 } -ol li { margin: -5px; list-style: decimal; list-style-position: inside } -ol .selected { font-weight: bold; background-color: #ffd; padding: 2px 0 } -p.error { padding: 10px; background-color: #f00; font-weight: bold; text-align: center; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } -p.error a { color: #fff } -.block { padding: 20px 25px; margin-bottom: 10px; border: 1px solid #ddd; background-color: #fff; text-align:left; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; min-width: 770px; max-width: 770px } -.traces { display: none; margin-top: 10px } -#message { margin-top: 30px; margin-bottom: 10px; padding: 20px 25px; border: 1px solid #ddd; text-align:left; background-color: #c8e8f3; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; min-width: 770px; max-width: 770px } -#content { border: 1px solid #ddd; margin-top: 10px; padding: 7px; overflow: auto; } -a.file_link { text-decoration: none; } -a.file_link:hover { text-decoration: underline; } -.code { overflow: auto; } -img { vertical-align: middle; } -.error { background-color: #f66 } -.linked ul, .linked li { padding-left: 0; display: inline } -.linked li { padding-right: 7px } -#logs { margin-top: 10px } + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.php index 931312bde4..8eba45f84e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.php @@ -2,7 +2,7 @@ at (formatArgs($trace['args']) ?>)
- in formatFile($trace['file'], $trace['line']) ?> line + in formatFile($trace['file'], $trace['line']) ?> »