2015-08-07 01:59:25 +02:00
|
|
|
<?php
|
2015-08-29 08:40:10 +02:00
|
|
|
namespace Icicle\Concurrent\Sync\Internal;
|
2015-08-07 01:59:25 +02:00
|
|
|
|
|
|
|
use Icicle\Concurrent\Exception\PanicError;
|
|
|
|
|
2015-12-05 06:50:32 +01:00
|
|
|
class ExitFailure implements ExitStatus
|
2015-08-07 01:59:25 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $message;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $code;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
private $trace;
|
|
|
|
|
2016-01-23 07:00:56 +01:00
|
|
|
public function __construct(\Throwable $exception)
|
2015-08-07 01:59:25 +02:00
|
|
|
{
|
|
|
|
$this->type = get_class($exception);
|
|
|
|
$this->message = $exception->getMessage();
|
|
|
|
$this->code = $exception->getCode();
|
|
|
|
$this->trace = $exception->getTraceAsString();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getResult()
|
|
|
|
{
|
|
|
|
throw new PanicError(
|
2015-08-27 16:10:08 +02:00
|
|
|
sprintf(
|
|
|
|
'Uncaught exception in execution context of type "%s" with message "%s"',
|
|
|
|
$this->type,
|
|
|
|
$this->message
|
|
|
|
),
|
2015-08-07 01:59:25 +02:00
|
|
|
$this->code,
|
|
|
|
$this->trace
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|