1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-02 17:52:14 +01:00
parallel/lib/Worker/TaskException.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2016-12-30 02:16:04 +01:00
<?php
2015-08-27 16:10:08 +02:00
namespace Amp\Parallel\Worker;
2016-08-18 18:04:48 +02:00
class TaskException extends \Exception {
/** @var string Class name of exception thrown from task. */
private $name;
/** @var string Stack trace of the exception thrown from task. */
2015-08-27 16:10:08 +02:00
private $trace;
/**
* @param string $name The exception class name.
2015-08-27 16:10:08 +02:00
* @param string $message The panic message.
* @param int $code The panic code.
* @param string $trace The panic stack trace.
*/
public function __construct(string $name, string $message = '', int $code = 0, string $trace = '') {
2015-08-27 16:10:08 +02:00
parent::__construct($message, $code);
$this->name = $name;
2015-08-27 16:10:08 +02:00
$this->trace = $trace;
}
2017-05-18 09:51:31 +02:00
/**
* Returns the class name of the exception thrown from the task.
*
* @return string
*/
public function getName(): string {
return $this->name;
}
2017-05-18 09:51:31 +02:00
2015-08-27 16:10:08 +02:00
/**
* Gets the stack trace at the point the exception was thrown in the task.
2015-08-27 16:10:08 +02:00
*
* @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;
}
}