mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Add simple output handling to exception classes
This commit is contained in:
parent
d316684995
commit
2d550a8db4
@ -7,4 +7,7 @@ namespace StaticPHP\Exception;
|
|||||||
/**
|
/**
|
||||||
* Exception caused by manual intervention.
|
* Exception caused by manual intervention.
|
||||||
*/
|
*/
|
||||||
class InterruptException extends SPCException {}
|
class InterruptException extends SPCException
|
||||||
|
{
|
||||||
|
protected bool $simple_output = true;
|
||||||
|
}
|
||||||
|
|||||||
@ -4,4 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace StaticPHP\Exception;
|
namespace StaticPHP\Exception;
|
||||||
|
|
||||||
class RegistryException extends SPCException {}
|
class RegistryException extends SPCException
|
||||||
|
{
|
||||||
|
protected bool $simple_output = true;
|
||||||
|
}
|
||||||
|
|||||||
@ -20,6 +20,8 @@ use StaticPHP\Package\TargetPackage;
|
|||||||
*/
|
*/
|
||||||
abstract class SPCException extends \Exception
|
abstract class SPCException extends \Exception
|
||||||
{
|
{
|
||||||
|
protected bool $simple_output = false;
|
||||||
|
|
||||||
/** @var null|array Package information */
|
/** @var null|array Package information */
|
||||||
private ?array $package_info = null;
|
private ?array $package_info = null;
|
||||||
|
|
||||||
@ -155,6 +157,16 @@ abstract class SPCException extends \Exception
|
|||||||
return $this->extra_log_files;
|
return $this->extra_log_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isSimpleOutput(): bool
|
||||||
|
{
|
||||||
|
return $this->simple_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSimpleOutput(bool $simple_output = true): void
|
||||||
|
{
|
||||||
|
$this->simple_output = $simple_output;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load stack trace information to detect Package, Builder, and Installer context.
|
* Load stack trace information to detect Package, Builder, and Installer context.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -10,4 +10,7 @@ namespace StaticPHP\Exception;
|
|||||||
* This exception is used to indicate that the SPC is being used incorrectly.
|
* This exception is used to indicate that the SPC is being used incorrectly.
|
||||||
* Such as when a command is not supported or an invalid argument is provided.
|
* Such as when a command is not supported or an invalid argument is provided.
|
||||||
*/
|
*/
|
||||||
class WrongUsageException extends SPCException {}
|
class WrongUsageException extends SPCException
|
||||||
|
{
|
||||||
|
protected bool $simple_output = true;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user