2015-08-07 01:59:25 +02:00
|
|
|
<?php
|
|
|
|
namespace Icicle\Concurrent\Sync;
|
|
|
|
|
|
|
|
use Icicle\Concurrent\Exception\PanicError;
|
|
|
|
|
2015-08-19 02:12:58 +02:00
|
|
|
class ExitFailure implements ExitStatusInterface
|
2015-08-07 01:59:25 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $message;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $code;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
private $trace;
|
|
|
|
|
|
|
|
public function __construct(\Exception $exception)
|
|
|
|
{
|
|
|
|
$this->type = get_class($exception);
|
|
|
|
$this->message = $exception->getMessage();
|
|
|
|
$this->code = $exception->getCode();
|
|
|
|
$this->trace = $exception->getTraceAsString();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getResult()
|
|
|
|
{
|
|
|
|
throw new PanicError(
|
|
|
|
sprintf('Uncaught exception in context of type "%s" with message "%s"', $this->type, $this->message),
|
|
|
|
$this->code,
|
|
|
|
$this->trace
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|