diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php
index <HASH>..<HASH> 100644
--- a/lib/Cake/Error/ExceptionRenderer.php
+++ b/lib/Cake/Error/ExceptionRenderer.php
@@ -179,7 +179,7 @@ class ExceptionRenderer {
  */
 	protected function _cakeError(CakeException $error) {
 		$url = $this->controller->request->here();
-		$code = $error->getCode();
+		$code = ($error->getCode() >= 400 && $error->getCode() < 506) ? $error->getCode() : 500;
 		$this->controller->response->statusCode($code);
 		$this->controller->set(array(
 			'code' => $code,
Adding error code checking around CakeException handling
SocketExceptions can have error codes outside of the HTTP values.