Skip to content

Commit b7fc837

Browse files
committed
feat: add HasExitCodeException and HasHttpStatusCodeException Interface
1 parent 3800c5d commit b7fc837

File tree

7 files changed

+45
-5
lines changed

7 files changed

+45
-5
lines changed

system/Database/Exceptions/DatabaseException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
namespace CodeIgniter\Database\Exceptions;
1313

14+
use CodeIgniter\Exceptions\HasExitCodeException;
1415
use Error;
1516

16-
class DatabaseException extends Error implements ExceptionInterface
17+
class DatabaseException extends Error implements ExceptionInterface, HasExitCodeException
1718
{
1819
/**
1920
* Exit status code

system/Exceptions/CastException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @codeCoverageIgnore
2020
*/
21-
class CastException extends CriticalError
21+
class CastException extends CriticalError implements HasExitCodeException
2222
{
2323
use DebugTraceableTrait;
2424

system/Exceptions/ConfigException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* Exception for automatic logging.
1616
*/
17-
class ConfigException extends CriticalError
17+
class ConfigException extends CriticalError implements HasExitCodeException
1818
{
1919
use DebugTraceableTrait;
2020

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/**
4+
* This file is part of CodeIgniter 4 framework.
5+
*
6+
* (c) CodeIgniter Foundation <[email protected]>
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE file that was distributed with this source code.
10+
*/
11+
12+
namespace CodeIgniter\Exceptions;
13+
14+
/**
15+
* Interface for Exceptions that has exception code as exit code.
16+
*/
17+
interface HasExitCodeException
18+
{
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/**
4+
* This file is part of CodeIgniter 4 framework.
5+
*
6+
* (c) CodeIgniter Foundation <[email protected]>
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE file that was distributed with this source code.
10+
*/
11+
12+
namespace CodeIgniter\Exceptions;
13+
14+
/**
15+
* Interface for Exceptions that has exception code as HTTP status code.
16+
*/
17+
interface HasHttpStatusCodeException
18+
{
19+
}

system/Exceptions/PageNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Config\Services;
1515
use OutOfBoundsException;
1616

17-
class PageNotFoundException extends OutOfBoundsException implements ExceptionInterface
17+
class PageNotFoundException extends OutOfBoundsException implements ExceptionInterface, HasHttpStatusCodeException
1818
{
1919
use DebugTraceableTrait;
2020

system/Router/Exceptions/RedirectException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111

1212
namespace CodeIgniter\Router\Exceptions;
1313

14+
use CodeIgniter\Exceptions\HasHttpStatusCodeException;
1415
use Exception;
1516

1617
/**
1718
* RedirectException
1819
*/
19-
class RedirectException extends Exception
20+
class RedirectException extends Exception implements HasHttpStatusCodeException
2021
{
2122
/**
2223
* Status code for redirects

0 commit comments

Comments
 (0)