Skip to content

Commit bc568eb

Browse files
committed
add the CLI exceptions
1 parent 238e267 commit bc568eb

6 files changed

Lines changed: 142 additions & 0 deletions
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <[email protected]>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
namespace CodeIgniter\CLI\Exceptions;
15+
16+
use CodeIgniter\Exceptions\RuntimeException;
17+
18+
/**
19+
* Exception thrown when the number of arguments passed to a command does not match the expected count.
20+
*/
21+
final class ArgumentCountMismatchException extends RuntimeException
22+
{
23+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <[email protected]>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
namespace CodeIgniter\CLI\Exceptions;
15+
16+
use CodeIgniter\Exceptions\RuntimeException;
17+
18+
/**
19+
* Exception thrown when an unknown command is attempted to be executed.
20+
*/
21+
final class CommandNotFoundException extends RuntimeException
22+
{
23+
public function __construct(string $command)
24+
{
25+
parent::__construct(lang('CLI.commandNotFound', [$command]));
26+
}
27+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <[email protected]>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
namespace CodeIgniter\CLI\Exceptions;
15+
16+
use CodeIgniter\Exceptions\InvalidArgumentException;
17+
18+
/**
19+
* Exception thrown when an invalid argument definition is provided for a spark command.
20+
*/
21+
final class InvalidArgumentDefinitionException extends InvalidArgumentException
22+
{
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <[email protected]>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
namespace CodeIgniter\CLI\Exceptions;
15+
16+
use CodeIgniter\Exceptions\InvalidArgumentException;
17+
18+
/**
19+
* Exception thrown when an invalid option definition is provided for a spark command.
20+
*/
21+
final class InvalidOptionDefinitionException extends InvalidArgumentException
22+
{
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <[email protected]>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
namespace CodeIgniter\CLI\Exceptions;
15+
16+
use CodeIgniter\Exceptions\RuntimeException;
17+
18+
/**
19+
* Exception thrown when a provided option value does not match its definition.
20+
*/
21+
final class OptionValueMismatchException extends RuntimeException
22+
{
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <[email protected]>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
namespace CodeIgniter\CLI\Exceptions;
15+
16+
use CodeIgniter\Exceptions\RuntimeException;
17+
18+
/**
19+
* Exception thrown when unknown options are provided to a CLI command.
20+
*/
21+
final class UnknownOptionException extends RuntimeException
22+
{
23+
}

0 commit comments

Comments
 (0)