2016-12-30 02:16:04 +01:00
|
|
|
<?php
|
2015-08-27 16:10:08 +02:00
|
|
|
|
2016-08-23 23:47:40 +02:00
|
|
|
namespace Amp\Parallel;
|
2016-08-18 18:04:48 +02:00
|
|
|
|
|
|
|
class PanicError extends \Error {
|
2016-09-02 06:38:00 +02:00
|
|
|
/** @var string Class name of uncaught exception. */
|
|
|
|
private $name;
|
2017-05-18 09:51:31 +02:00
|
|
|
|
2016-08-26 17:10:03 +02:00
|
|
|
/** @var string Stack trace of the panic. */
|
2015-08-27 16:10:08 +02:00
|
|
|
private $trace;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new panic error.
|
|
|
|
*
|
2017-06-28 12:41:59 +02:00
|
|
|
* @param string $name The uncaught exception class.
|
2015-08-27 16:10:08 +02:00
|
|
|
* @param string $message The panic message.
|
2017-06-28 12:41:59 +02:00
|
|
|
* @param string $trace The panic stack trace.
|
2015-08-27 16:10:08 +02:00
|
|
|
*/
|
2017-11-10 18:32:15 +01:00
|
|
|
public function __construct(string $name, string $message = '', string $trace = '') {
|
2017-06-28 12:41:59 +02:00
|
|
|
parent::__construct($message);
|
|
|
|
|
2016-09-02 06:38:00 +02:00
|
|
|
$this->name = $name;
|
2015-08-27 16:10:08 +02:00
|
|
|
$this->trace = $trace;
|
|
|
|
}
|
2017-05-18 09:51:31 +02:00
|
|
|
|
2016-09-02 06:38:00 +02:00
|
|
|
/**
|
|
|
|
* Returns the class name of the uncaught exception.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName(): string {
|
|
|
|
return $this->name;
|
|
|
|
}
|
2015-08-27 16:10:08 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the stack trace at the point the panic occurred.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-08-19 00:36:58 +02:00
|
|
|
public function getPanicTrace(): string {
|
2015-08-27 16:10:08 +02:00
|
|
|
return $this->trace;
|
|
|
|
}
|
|
|
|
}
|