diff --git a/src/Context/ContextPanicError.php b/src/Context/ContextPanicError.php index 77cd3da..02066ec 100644 --- a/src/Context/ContextPanicError.php +++ b/src/Context/ContextPanicError.php @@ -8,9 +8,4 @@ namespace Amp\Parallel\Context; final class ContextPanicError extends \Error { use Internal\ContextException; - - protected function invokeExceptionConstructor(string $message, ?\Throwable $previous): void - { - parent::__construct($message, 0, $previous); - } } diff --git a/src/Context/Internal/ContextException.php b/src/Context/Internal/ContextException.php index 636af74..aac370c 100644 --- a/src/Context/Internal/ContextException.php +++ b/src/Context/Internal/ContextException.php @@ -28,7 +28,7 @@ trait ContextException . ' if the Xdebug extension is enabled, set "xdebug.mode" to "debug" to include' . ' the exception stack trace in the context in the exception message'; - $this->invokeExceptionConstructor(\sprintf( + parent::__construct(\sprintf( $format, $className, $originalMessage, @@ -36,11 +36,9 @@ trait ContextException $originalFile, $originalLine, self::class, - ), $previous); + ), previous: $previous); } - abstract protected function invokeExceptionConstructor(string $message, ?\Throwable $previous): void; - public function __toString(): string { return \sprintf("%s\nStack trace in context:\n%s", $this->getMessage(), $this->getOriginalTraceAsString()); diff --git a/src/Worker/TaskFailureError.php b/src/Worker/TaskFailureError.php index bdc5038..171c128 100644 --- a/src/Worker/TaskFailureError.php +++ b/src/Worker/TaskFailureError.php @@ -7,9 +7,4 @@ use Amp\Parallel\Context\Internal; final class TaskFailureError extends \Error implements TaskFailureThrowable { use Internal\ContextException; - - protected function invokeExceptionConstructor(string $message, ?\Throwable $previous): void - { - parent::__construct($message, 0, $previous); - } } diff --git a/src/Worker/TaskFailureException.php b/src/Worker/TaskFailureException.php index db10f85..6969aac 100644 --- a/src/Worker/TaskFailureException.php +++ b/src/Worker/TaskFailureException.php @@ -7,9 +7,4 @@ use Amp\Parallel\Context\Internal; final class TaskFailureException extends \Exception implements TaskFailureThrowable { use Internal\ContextException; - - protected function invokeExceptionConstructor(string $message, ?\Throwable $previous): void - { - parent::__construct($message, 0, $previous); - } }