Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DependencyInjection] Added missing support for setting previous exception #7313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. '
Expand All @@ -35,7 +35,7 @@ public function __construct($sourceServiceId, $sourceScope, $destServiceId, $des
$destScope,
$sourceScope,
$destScope
));
), 0, $previous);

$this->sourceServiceId = $sourceServiceId;
$this->sourceScope = $sourceScope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. '
Expand All @@ -34,7 +34,7 @@ public function __construct($sourceServiceId, $sourceScope, $destServiceId, $des
$sourceServiceId,
$destScope,
$destServiceId
));
), 0, $previous);

$this->sourceServiceId = $sourceServiceId;
$this->sourceScope = $sourceScope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ 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);
} else {
$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;
Expand Down