2016-08-22 06:40:48 +02:00
|
|
|
<?php declare(strict_types = 1);
|
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 TaskException extends \Exception {
|
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.
|
|
|
|
*
|
|
|
|
* @param string $message The panic message.
|
|
|
|
* @param int $code The panic code.
|
|
|
|
* @param string $trace The panic stack trace.
|
|
|
|
*/
|
2016-08-18 18:04:48 +02:00
|
|
|
public function __construct(string $message = '', int $code = 0, string $trace = '') {
|
2015-08-27 16:10:08 +02:00
|
|
|
parent::__construct($message, $code);
|
|
|
|
$this->trace = $trace;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the stack trace at the point the panic occurred.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-08-18 18:04:48 +02:00
|
|
|
public function getWorkerTrace(): string {
|
2015-08-27 16:10:08 +02:00
|
|
|
return $this->trace;
|
|
|
|
}
|
|
|
|
}
|