Browse Source

Fix $previous becoming null only

Also fixed $code becoming 500 when null given.
chinpei215 8 years ago
parent
commit
bf374572d7

+ 2 - 9
src/Datasource/Exception/PageOutOfBoundsException.php

@@ -25,14 +25,7 @@ class PageOutOfBoundsException extends Exception
     protected $_messageTemplate = 'Page number %s could not be found.';
 
     /**
-     * Constructor
-     *
-     * @param array|null $message Paging info.
-     * @param int $code The code of the error, is also the HTTP status code for the error.
-     * @param \Exception|null $previous The previous exception.
+     * {@inheritDoc}
      */
-    public function __construct($message = null, $code = 404, $previous = null)
-    {
-        parent::__construct($message, $code, $previous = null);
-    }
+    protected $_defaultCode = 404;
 }

+ 1 - 0
tests/TestCase/ExceptionsTest.php

@@ -145,6 +145,7 @@ class ExceptionsTest extends TestCase
             ['Cake\Datasource\Exception\MissingDatasourceConfigException', 500],
             ['Cake\Datasource\Exception\MissingDatasourceException', 500],
             ['Cake\Datasource\Exception\MissingModelException', 500],
+            ['Cake\Datasource\Exception\PageOutOfBoundsException', 404],
             ['Cake\Datasource\Exception\RecordNotFoundException', 404],
             ['Cake\Mailer\Exception\MissingActionException', 404],
             ['Cake\Mailer\Exception\MissingMailerException', 500],