diff options
Diffstat (limited to 'src/Execution')
| -rw-r--r-- | src/Execution/TrapException.php | 17 | ||||
| -rw-r--r-- | src/Execution/TrapKind.php | 11 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/Execution/TrapException.php b/src/Execution/TrapException.php index 2948e8d..3e6a440 100644 --- a/src/Execution/TrapException.php +++ b/src/Execution/TrapException.php @@ -5,7 +5,24 @@ declare(strict_types=1); namespace Nsfisis\Waddiwasi\Execution; use RuntimeException; +use Throwable; class TrapException extends RuntimeException { + private readonly TrapKind $trapKind; + + public function __construct( + string $message = "", + int $code = 0, + ?Throwable $previous = null, + TrapKind $trapKind = TrapKind::Unknown, + ) { + parent::__construct($message, $code, $previous); + $this->trapKind = $trapKind; + } + + public function getTrapKind(): TrapKind + { + return $this->trapKind; + } } diff --git a/src/Execution/TrapKind.php b/src/Execution/TrapKind.php new file mode 100644 index 0000000..47c1c77 --- /dev/null +++ b/src/Execution/TrapKind.php @@ -0,0 +1,11 @@ +<?php + +declare(strict_types=1); + +namespace Nsfisis\Waddiwasi\Execution; + +enum TrapKind +{ + case Unknown; + case OutOfBoundsMemoryAccess; +} |
