diff --git a/system/Database/Exceptions/DatabaseException.php b/system/Database/Exceptions/DatabaseException.php index a2b3b7637ce7..62a1b23ac52e 100644 --- a/system/Database/Exceptions/DatabaseException.php +++ b/system/Database/Exceptions/DatabaseException.php @@ -11,9 +11,10 @@ namespace CodeIgniter\Database\Exceptions; +use CodeIgniter\Exceptions\HasExitCodeException; use Error; -class DatabaseException extends Error implements ExceptionInterface +class DatabaseException extends Error implements ExceptionInterface, HasExitCodeException { /** * Exit status code diff --git a/system/Exceptions/CastException.php b/system/Exceptions/CastException.php index 5e41631536c7..230cd61ef51d 100644 --- a/system/Exceptions/CastException.php +++ b/system/Exceptions/CastException.php @@ -18,7 +18,7 @@ * * @codeCoverageIgnore */ -class CastException extends CriticalError +class CastException extends CriticalError implements HasExitCodeException { use DebugTraceableTrait; diff --git a/system/Exceptions/ConfigException.php b/system/Exceptions/ConfigException.php index 41ae4959e594..9a1c2e6fb5e5 100644 --- a/system/Exceptions/ConfigException.php +++ b/system/Exceptions/ConfigException.php @@ -14,7 +14,7 @@ /** * Exception for automatic logging. */ -class ConfigException extends CriticalError +class ConfigException extends CriticalError implements HasExitCodeException { use DebugTraceableTrait; diff --git a/system/Exceptions/HasExitCodeException.php b/system/Exceptions/HasExitCodeException.php new file mode 100644 index 000000000000..07ec915e80a3 --- /dev/null +++ b/system/Exceptions/HasExitCodeException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace CodeIgniter\Exceptions; + +/** + * Interface for Exceptions that has exception code as exit code. + */ +interface HasExitCodeException +{ +} diff --git a/system/Exceptions/HasHttpStatusCodeException.php b/system/Exceptions/HasHttpStatusCodeException.php new file mode 100644 index 000000000000..647b654e2077 --- /dev/null +++ b/system/Exceptions/HasHttpStatusCodeException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace CodeIgniter\Exceptions; + +/** + * Interface for Exceptions that has exception code as HTTP status code. + */ +interface HasHttpStatusCodeException +{ +} diff --git a/system/Exceptions/PageNotFoundException.php b/system/Exceptions/PageNotFoundException.php index daa98a5ddf02..a91e92b3c0df 100644 --- a/system/Exceptions/PageNotFoundException.php +++ b/system/Exceptions/PageNotFoundException.php @@ -14,7 +14,7 @@ use Config\Services; use OutOfBoundsException; -class PageNotFoundException extends OutOfBoundsException implements ExceptionInterface +class PageNotFoundException extends OutOfBoundsException implements ExceptionInterface, HasHttpStatusCodeException { use DebugTraceableTrait; diff --git a/system/Router/Exceptions/RedirectException.php b/system/Router/Exceptions/RedirectException.php index b2456f367676..5e18805edad0 100644 --- a/system/Router/Exceptions/RedirectException.php +++ b/system/Router/Exceptions/RedirectException.php @@ -11,12 +11,13 @@ namespace CodeIgniter\Router\Exceptions; +use CodeIgniter\Exceptions\HasHttpStatusCodeException; use Exception; /** * RedirectException */ -class RedirectException extends Exception +class RedirectException extends Exception implements HasHttpStatusCodeException { /** * Status code for redirects