mirror of
https://github.com/danog/parallel.git
synced 2024-12-11 08:39:48 +01:00
48 lines
1013 B
PHP
48 lines
1013 B
PHP
<?php
|
|
|
|
namespace Amp\Parallel\Sync;
|
|
|
|
final class PanicError extends \Error
|
|
{
|
|
/** @var string Class name of uncaught exception. */
|
|
private $name;
|
|
|
|
/** @var string Stack trace of the panic. */
|
|
private $trace;
|
|
|
|
/**
|
|
* Creates a new panic error.
|
|
*
|
|
* @param string $name The uncaught exception class.
|
|
* @param string $message The panic message.
|
|
* @param string $trace The panic stack trace.
|
|
*/
|
|
public function __construct(string $name, string $message = '', string $trace = '')
|
|
{
|
|
parent::__construct($message);
|
|
|
|
$this->name = $name;
|
|
$this->trace = $trace;
|
|
}
|
|
|
|
/**
|
|
* Returns the class name of the uncaught exception.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getName(): string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* Gets the stack trace at the point the panic occurred.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getPanicTrace(): string
|
|
{
|
|
return $this->trace;
|
|
}
|
|
}
|