[DependencyInjection] Added missing support for setting previous exception
This commit is contained in:
parent
ea252671b0
commit
9b4cd73748
@ -21,9 +21,9 @@ class InactiveScopeException extends RuntimeException
|
||||
private $serviceId;
|
||||
private $scope;
|
||||
|
||||
public function __construct($serviceId, $scope)
|
||||
public function __construct($serviceId, $scope, \Exception $previous = null)
|
||||
{
|
||||
parent::__construct(sprintf('You cannot create a service ("%s") of an inactive scope ("%s").', $serviceId, $scope));
|
||||
parent::__construct(sprintf('You cannot create a service ("%s") of an inactive scope ("%s").', $serviceId, $scope), 0, $previous);
|
||||
|
||||
$this->serviceId = $serviceId;
|
||||
$this->scope = $scope;
|
||||
|
@ -20,9 +20,9 @@ class ParameterCircularReferenceException extends RuntimeException
|
||||
{
|
||||
private $parameters;
|
||||
|
||||
public function __construct($parameters)
|
||||
public function __construct($parameters, \Exception $previous = null)
|
||||
{
|
||||
parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]));
|
||||
parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous);
|
||||
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
@ -29,12 +29,14 @@ class ParameterNotFoundException extends InvalidArgumentException
|
||||
* @param string $sourceId The service id that references the non-existent parameter
|
||||
* @param string $sourceKey The parameter key that references the non-existent parameter
|
||||
*/
|
||||
public function __construct($key, $sourceId = null, $sourceKey = null)
|
||||
public function __construct($key, $sourceId = null, $sourceKey = null, \Exception $previous = null)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->sourceId = $sourceId;
|
||||
$this->sourceKey = $sourceKey;
|
||||
|
||||
parent::__construct('', 0, $previous);
|
||||
|
||||
$this->updateRepr();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class ScopeCrossingInjectionException extends RuntimeException
|
||||
private $destServiceId;
|
||||
private $destScope;
|
||||
|
||||
public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope)
|
||||
public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope, \Exception $previous = null)
|
||||
{
|
||||
parent::__construct(sprintf(
|
||||
'Scope Crossing Injection detected: The definition "%s" references the service "%s" which belongs to another scope hierarchy. '
|
||||
@ -35,7 +35,7 @@ class ScopeCrossingInjectionException extends RuntimeException
|
||||
$destScope,
|
||||
$sourceScope,
|
||||
$destScope
|
||||
));
|
||||
), 0, $previous);
|
||||
|
||||
$this->sourceServiceId = $sourceServiceId;
|
||||
$this->sourceScope = $sourceScope;
|
||||
|
@ -23,7 +23,7 @@ class ScopeWideningInjectionException extends RuntimeException
|
||||
private $destServiceId;
|
||||
private $destScope;
|
||||
|
||||
public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope)
|
||||
public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope, \Exception $previous = null)
|
||||
{
|
||||
parent::__construct(sprintf(
|
||||
'Scope Widening Injection detected: The definition "%s" references the service "%s" which belongs to a narrower scope. '
|
||||
@ -34,7 +34,7 @@ class ScopeWideningInjectionException extends RuntimeException
|
||||
$sourceServiceId,
|
||||
$destScope,
|
||||
$destServiceId
|
||||
));
|
||||
), 0, $previous);
|
||||
|
||||
$this->sourceServiceId = $sourceServiceId;
|
||||
$this->sourceScope = $sourceScope;
|
||||
|
@ -21,9 +21,9 @@ class ServiceCircularReferenceException extends RuntimeException
|
||||
private $serviceId;
|
||||
private $path;
|
||||
|
||||
public function __construct($serviceId, array $path)
|
||||
public function __construct($serviceId, array $path, \Exception $previous = null)
|
||||
{
|
||||
parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)));
|
||||
parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous);
|
||||
|
||||
$this->serviceId = $serviceId;
|
||||
$this->path = $path;
|
||||
|
@ -21,7 +21,7 @@ class ServiceNotFoundException extends InvalidArgumentException
|
||||
private $id;
|
||||
private $sourceId;
|
||||
|
||||
public function __construct($id, $sourceId = null)
|
||||
public function __construct($id, $sourceId = null, \Exception $previous = null)
|
||||
{
|
||||
if (null === $sourceId) {
|
||||
$msg = sprintf('You have requested a non-existent service "%s".', $id);
|
||||
@ -29,7 +29,7 @@ class ServiceNotFoundException extends InvalidArgumentException
|
||||
$msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id);
|
||||
}
|
||||
|
||||
parent::__construct($msg);
|
||||
parent::__construct($msg, 0, $previous);
|
||||
|
||||
$this->id = $id;
|
||||
$this->sourceId = $sourceId;
|
||||
|
Reference in New Issue
Block a user