diff --git a/cake/libs/controller/cake_error_controller.php b/cake/libs/controller/cake_error_controller.php
index a5293d276..765e79f30 100644
--- a/cake/libs/controller/cake_error_controller.php
+++ b/cake/libs/controller/cake_error_controller.php
@@ -40,7 +40,9 @@ class CakeErrorController extends AppController {
 	function beforeRender() {
 		parent::beforeRender();
 		foreach ($this->viewVars as $key => $value) {
-			$this->viewVars[$key] = h($value);
+			if (!is_object($value)){ 
+				$this->viewVars[$key] = h($value);
+			}
 		}
 	}
 }
\ No newline at end of file
diff --git a/cake/libs/error_handler.php b/cake/libs/error_handler.php
index 15fd4b101..c1b7007df 100644
--- a/cake/libs/error_handler.php
+++ b/cake/libs/error_handler.php
@@ -200,7 +200,8 @@ class ErrorHandler {
 		$this->controller->set(array(
 			'code' => $code,
 			'url' => h($url),
-			'name' => $error->getMessage()
+			'name' => $error->getMessage(),
+			'error' => $error,
 		));
 		$this->controller->set($error->getAttributes());
 		$this->_outputMessage($this->template);
diff --git a/cake/libs/view/errors/missing_action.ctp b/cake/libs/view/errors/missing_action.ctp
index fcaf5e5bf..85aae2dac 100644
--- a/cake/libs/view/errors/missing_action.ctp
+++ b/cake/libs/view/errors/missing_action.ctp
@@ -41,4 +41,5 @@ class <?php echo $controller;?> extends AppController {
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s.'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_action.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_behavior_class.ctp b/cake/libs/view/errors/missing_behavior_class.ctp
index 09dd42cbd..3bdc45a92 100644
--- a/cake/libs/view/errors/missing_behavior_class.ctp
+++ b/cake/libs/view/errors/missing_behavior_class.ctp
@@ -36,4 +36,6 @@ class <?php echo $class;?> extends ModelBehavior {
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_behavior_class.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_behavior_file.ctp b/cake/libs/view/errors/missing_behavior_file.ctp
index aba397885..a5a800bc6 100644
--- a/cake/libs/view/errors/missing_behavior_file.ctp
+++ b/cake/libs/view/errors/missing_behavior_file.ctp
@@ -37,3 +37,5 @@ class <?php echo $class;?> extends ModelBehavior {
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_behavior_file.ctp'); ?>
 </p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_component_class.ctp b/cake/libs/view/errors/missing_component_class.ctp
index 6829c781d..85464acf6 100644
--- a/cake/libs/view/errors/missing_component_class.ctp
+++ b/cake/libs/view/errors/missing_component_class.ctp
@@ -36,4 +36,6 @@ class <?php echo $class;?> extends Component {<br />
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_component_class.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_component_file.ctp b/cake/libs/view/errors/missing_component_file.ctp
index ff57d432b..ea9df3b9c 100644
--- a/cake/libs/view/errors/missing_component_file.ctp
+++ b/cake/libs/view/errors/missing_component_file.ctp
@@ -36,4 +36,6 @@ class <?php echo $class;?> extends Component {<br />
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_component_file.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_connection.ctp b/cake/libs/view/errors/missing_connection.ctp
index 633997e7e..82c62bbb0 100644
--- a/cake/libs/view/errors/missing_connection.ctp
+++ b/cake/libs/view/errors/missing_connection.ctp
@@ -29,4 +29,6 @@
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s.'), APP_DIR . DS . 'views' . DS . 'errors' . DS . basename(__FILE__)); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_controller.ctp b/cake/libs/view/errors/missing_controller.ctp
index 855f0011d..afcef66fc 100644
--- a/cake/libs/view/errors/missing_controller.ctp
+++ b/cake/libs/view/errors/missing_controller.ctp
@@ -36,4 +36,6 @@ class <?php echo $controller;?> extends AppController {
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_controller.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
diff --git a/cake/libs/view/errors/missing_database.ctp b/cake/libs/view/errors/missing_database.ctp
index 05b248b28..19750015d 100644
--- a/cake/libs/view/errors/missing_database.ctp
+++ b/cake/libs/view/errors/missing_database.ctp
@@ -29,4 +29,6 @@
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_scaffolddb.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_helper_class.ctp b/cake/libs/view/errors/missing_helper_class.ctp
index 9de192c14..f98ae4262 100644
--- a/cake/libs/view/errors/missing_helper_class.ctp
+++ b/cake/libs/view/errors/missing_helper_class.ctp
@@ -36,4 +36,6 @@ class <?php echo $class;?> extends AppHelper {
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_helper_class.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_helper_file.ctp b/cake/libs/view/errors/missing_helper_file.ctp
index 537ca3ad0..e7ca70cf7 100644
--- a/cake/libs/view/errors/missing_helper_file.ctp
+++ b/cake/libs/view/errors/missing_helper_file.ctp
@@ -37,3 +37,5 @@ class <?php echo $class;?> extends AppHelper {
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_helper_file.ctp'); ?>
 </p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_layout.ctp b/cake/libs/view/errors/missing_layout.ctp
index 02cfba190..128bbf3a5 100644
--- a/cake/libs/view/errors/missing_layout.ctp
+++ b/cake/libs/view/errors/missing_layout.ctp
@@ -29,4 +29,6 @@
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_layout.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_table.ctp b/cake/libs/view/errors/missing_table.ctp
index 33d009293..03ba1d55c 100644
--- a/cake/libs/view/errors/missing_table.ctp
+++ b/cake/libs/view/errors/missing_table.ctp
@@ -25,4 +25,6 @@
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_table.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/missing_view.ctp b/cake/libs/view/errors/missing_view.ctp
index 55aef34ce..4c1e88335 100644
--- a/cake/libs/view/errors/missing_view.ctp
+++ b/cake/libs/view/errors/missing_view.ctp
@@ -29,4 +29,6 @@
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'missing_view.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/private_action.ctp b/cake/libs/view/errors/private_action.ctp
index ab9f13cdc..d26d98995 100644
--- a/cake/libs/view/errors/private_action.ctp
+++ b/cake/libs/view/errors/private_action.ctp
@@ -25,4 +25,6 @@
 <p class="notice">
 	<strong><?php echo __('Notice'); ?>: </strong>
 	<?php printf(__('If you want to customize this error message, create %s'), APP_DIR . DS . 'views' . DS . 'errors' . DS . 'private_action.ctp'); ?>
-</p>
\ No newline at end of file
+</p>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file
diff --git a/cake/libs/view/errors/scaffold_error.ctp b/cake/libs/view/errors/scaffold_error.ctp
index 7c1800b42..e9efe610c 100644
--- a/cake/libs/view/errors/scaffold_error.ctp
+++ b/cake/libs/view/errors/scaffold_error.ctp
@@ -32,4 +32,6 @@ function _scaffoldError() {<br />
 
 }
 ?&gt;
-</pre>
\ No newline at end of file
+</pre>
+
+<?php echo $this->element('exception_stack_trace'); ?>
\ No newline at end of file