Added Exception classes for RTEX
This commit is contained in:
parent
6b45b56b1b
commit
753d42d159
10 changed files with 169 additions and 8 deletions
|
@ -5,12 +5,10 @@
|
||||||
abstract class RuntimeExceptionCode
|
abstract class RuntimeExceptionCode
|
||||||
{
|
{
|
||||||
const Exception = 0;
|
const Exception = 0;
|
||||||
const AttributeException = -100;
|
const ImportException = -100;
|
||||||
const ImportException = -101;
|
const KeyException = -101;
|
||||||
const KeyException = -102;
|
const NameException = -102;
|
||||||
const NameException = -103;
|
const TypeException = -103;
|
||||||
const TypeException = -104;
|
const UndefinedMethodException = -104;
|
||||||
const ValueException = -105;
|
const ZeroDivisionException = -105;
|
||||||
const ZeroDivisionException = -106;
|
|
||||||
|
|
||||||
}
|
}
|
19
src/RTEX/Exceptions/EvaluationException.php
Normal file
19
src/RTEX/Exceptions/EvaluationException.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class EvaluationException extends Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param int $code
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
18
src/RTEX/Exceptions/InstructionException.php
Normal file
18
src/RTEX/Exceptions/InstructionException.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class InstructionException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param int $code
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
18
src/RTEX/Exceptions/Runtime/Exception.php
Normal file
18
src/RTEX/Exceptions/Runtime/Exception.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions\Runtime;
|
||||||
|
|
||||||
|
use RTEX\Abstracts\RuntimeExceptionCode;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class Exception extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, RuntimeExceptionCode::Exception, $previous);
|
||||||
|
}
|
||||||
|
}
|
18
src/RTEX/Exceptions/Runtime/ImportException.php
Normal file
18
src/RTEX/Exceptions/Runtime/ImportException.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions\Runtime;
|
||||||
|
|
||||||
|
use RTEX\Abstracts\RuntimeExceptionCode;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class ImportException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, RuntimeExceptionCode::ImportException, $previous);
|
||||||
|
}
|
||||||
|
}
|
18
src/RTEX/Exceptions/Runtime/KeyException.php
Normal file
18
src/RTEX/Exceptions/Runtime/KeyException.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions\Runtime;
|
||||||
|
|
||||||
|
use RTEX\Abstracts\RuntimeExceptionCode;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class KeyException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, RuntimeExceptionCode::KeyException, $previous);
|
||||||
|
}
|
||||||
|
}
|
18
src/RTEX/Exceptions/Runtime/NameException.php
Normal file
18
src/RTEX/Exceptions/Runtime/NameException.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions\Runtime;
|
||||||
|
|
||||||
|
use RTEX\Abstracts\RuntimeExceptionCode;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class NameException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, RuntimeExceptionCode::NameException, $previous);
|
||||||
|
}
|
||||||
|
}
|
18
src/RTEX/Exceptions/Runtime/TypeException.php
Normal file
18
src/RTEX/Exceptions/Runtime/TypeException.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions\Runtime;
|
||||||
|
|
||||||
|
use RTEX\Abstracts\RuntimeExceptionCode;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class TypeException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, RuntimeExceptionCode::TypeException, $previous);
|
||||||
|
}
|
||||||
|
}
|
18
src/RTEX/Exceptions/Runtime/UndefinedMethodException.php
Normal file
18
src/RTEX/Exceptions/Runtime/UndefinedMethodException.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions\Runtime;
|
||||||
|
|
||||||
|
use RTEX\Abstracts\RuntimeExceptionCode;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class UndefinedMethodException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, RuntimeExceptionCode::UndefinedMethodException, $previous);
|
||||||
|
}
|
||||||
|
}
|
18
src/RTEX/Exceptions/Runtime/ZeroDivisionException.php
Normal file
18
src/RTEX/Exceptions/Runtime/ZeroDivisionException.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RTEX\Exceptions\Runtime;
|
||||||
|
|
||||||
|
use RTEX\Abstracts\RuntimeExceptionCode;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class ZeroDivisionException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, RuntimeExceptionCode::ZeroDivisionException, $previous);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue