Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 169e49d

Browse filesBrowse files
Fix exception messages containing exception messages
1 parent bd952b9 commit 169e49d
Copy full SHA for 169e49d

File tree

16 files changed

+19
-19
lines changed
Filter options

16 files changed

+19
-19
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function locate($template, $currentPath = null, $first = true)
7979
try {
8080
return $this->cacheHits[$key] = $this->locator->locate($template->getPath(), $currentPath);
8181
} catch (\InvalidArgumentException $e) {
82-
throw new \InvalidArgumentException(sprintf('Unable to find template "%s" : "%s".', $template, $e->getMessage()), 0, $e);
82+
throw new \InvalidArgumentException(sprintf('Unable to find template "%s": ', $template).$e->getMessage(), 0, $e);
8383
}
8484
}
8585
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testRedisCachePools()
4040
}
4141
$this->markTestSkipped($e->getMessage());
4242
} catch (InvalidArgumentException $e) {
43-
if (0 !== strpos($e->getMessage(), 'Redis connection failed')) {
43+
if (0 !== strpos($e->getMessage(), 'Redis connection ')) {
4444
throw $e;
4545
}
4646
$this->markTestSkipped($e->getMessage());

‎src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testCreateConnection()
5959
public function testFailedCreateConnection($dsn)
6060
{
6161
$this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
62-
$this->expectExceptionMessage('Redis connection failed');
62+
$this->expectExceptionMessage('Redis connection ');
6363
RedisAdapter::createConnection($dsn);
6464
}
6565

‎src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Simple/RedisCacheTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testCreateConnection()
4949
public function testFailedCreateConnection($dsn)
5050
{
5151
$this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
52-
$this->expectExceptionMessage('Redis connection failed');
52+
$this->expectExceptionMessage('Redis connection ');
5353
RedisCache::createConnection($dsn);
5454
}
5555

‎src/Symfony/Component/Cache/Traits/RedisTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,23 @@ public static function createConnection($dsn, array $options = [])
120120
try {
121121
@$redis->{$connect}($params['host'], $params['port'], $params['timeout'], $params['persistent_id'], $params['retry_interval']);
122122
} catch (\RedisException $e) {
123-
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): "%s".', $e->getMessage(), $dsn));
123+
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e->getMessage());
124124
}
125125

126126
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
127127
$isConnected = $redis->isConnected();
128128
restore_error_handler();
129129
if (!$isConnected) {
130130
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
131-
throw new InvalidArgumentException(sprintf('Redis connection failed%s: "%s".', $error, $dsn));
131+
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.');
132132
}
133133

134134
if ((null !== $auth && !$redis->auth($auth))
135135
|| ($params['dbindex'] && !$redis->select($params['dbindex']))
136136
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
137137
) {
138138
$e = preg_replace('/^ERR /', '', $redis->getLastError());
139-
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): "%s".', $e, $dsn));
139+
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e.'.');
140140
}
141141

142142
return true;

‎src/Symfony/Component/Config/Definition/BaseNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/BaseNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ final public function finalize($value)
335335
} catch (Exception $e) {
336336
throw $e;
337337
} catch (\Exception $e) {
338-
throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": '.$e->getMessage(), $this->getPath()), $e->getCode(), $e);
338+
throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": ', $this->getPath()).$e->getMessage(), $e->getCode(), $e);
339339
}
340340
}
341341

‎src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ protected function getConstructor(Definition $definition, $required)
126126
throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
127127
}
128128
} catch (\ReflectionException $e) {
129-
throw new RuntimeException(sprintf('Invalid service "%s": '.lcfirst($e->getMessage()), $this->currentId));
129+
throw new RuntimeException(sprintf('Invalid service "%s": ', $this->currentId).lcfirst($e->getMessage()));
130130
}
131131
if (!$r = $r->getConstructor()) {
132132
if ($required) {
133133
throw new RuntimeException(sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, sprintf($class !== $this->currentId ? ' "%s"' : '', $class)));
134134
}
135135
} elseif (!$r->isPublic()) {
136-
throw new RuntimeException(sprintf('Invalid service "%s": %s must be public.', $this->currentId, sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class)));
136+
throw new RuntimeException(sprintf('Invalid service "%s": ', $this->currentId).sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class).' must be public.');
137137
}
138138

139139
return $r;

‎src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ private function parseFileToDOM($file)
378378
try {
379379
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
380380
} catch (\InvalidArgumentException $e) {
381-
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": "%s".', $file, $e->getMessage()), $e->getCode(), $e);
381+
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": ', $file).$e->getMessage(), $e->getCode(), $e);
382382
}
383383

384384
$this->validateExtensions($dom, $file);

‎src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ protected function loadFile($file)
660660
try {
661661
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
662662
} catch (ParseException $e) {
663-
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML', $file).': '.$e->getMessage(), 0, $e);
663+
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: ', $file).$e->getMessage(), 0, $e);
664664
} finally {
665665
restore_error_handler();
666666
}

‎src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getController(Request $request)
8888
try {
8989
$callable = $this->createController($controller);
9090
} catch (\InvalidArgumentException $e) {
91-
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: '.$e->getMessage(), $request->getPathInfo()), 0, $e);
91+
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$e->getMessage(), 0, $e);
9292
}
9393

9494
return $callable;

‎src/Symfony/Component/Routing/Loader/YamlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/YamlFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function load($file, $type = null)
6666
try {
6767
$parsedConfig = $this->yamlParser->parseFile($path);
6868
} catch (ParseException $e) {
69-
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML', $path).': '.$e->getMessage(), 0, $e);
69+
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: ', $path).$e->getMessage(), 0, $e);
7070
} finally {
7171
restore_error_handler();
7272
}

‎src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function handle(GetResponseEvent $event)
100100
try {
101101
$this->tokenStorage->setToken($this->attemptSwitchUser($request, $username));
102102
} catch (AuthenticationException $e) {
103-
throw new \LogicException(sprintf('Switch User failed: "%s".', $e->getMessage()));
103+
throw new \LogicException('Switch User failed: '.$e->getMessage());
104104
}
105105
}
106106

‎src/Symfony/Component/Translation/Loader/XliffFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Loader/XliffFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function extract($resource, MessageCatalogue $catalogue, $domain)
5353
try {
5454
$dom = XmlUtils::loadFile($resource);
5555
} catch (\InvalidArgumentException $e) {
56-
throw new InvalidResourceException(sprintf('Unable to load "%s": '.$e->getMessage(), $resource), $e->getCode(), $e);
56+
throw new InvalidResourceException(sprintf('Unable to load "%s": ', $resource).$e->getMessage(), $e->getCode(), $e);
5757
}
5858

5959
$xliffVersion = $this->getVersionNumber($dom);

‎src/Symfony/Component/Translation/Loader/YamlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Loader/YamlFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function loadResource($resource)
4747
try {
4848
$messages = $this->yamlParser->parseFile($resource);
4949
} catch (ParseException $e) {
50-
throw new InvalidResourceException(sprintf('The file "%s" does not contain valid YAML', $resource).': '.$e->getMessage(), 0, $e);
50+
throw new InvalidResourceException(sprintf('The file "%s" does not contain valid YAML: ', $resource).$e->getMessage(), 0, $e);
5151
} finally {
5252
restore_error_handler();
5353
}

‎src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function validate($value, Constraint $constraint)
5555
try {
5656
$comparedValue = $this->getPropertyAccessor()->getValue($object, $path);
5757
} catch (NoSuchPropertyException $e) {
58-
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: '.$e->getMessage(), $path, \get_class($constraint)), 0, $e);
58+
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, \get_class($constraint)).$e->getMessage(), 0, $e);
5959
}
6060
} else {
6161
$comparedValue = $constraint->value;

‎src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private function parseFile($path)
124124
try {
125125
$classes = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT);
126126
} catch (ParseException $e) {
127-
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML', $path).': '.$e->getMessage(), 0, $e);
127+
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: ', $path).$e->getMessage(), 0, $e);
128128
} finally {
129129
restore_error_handler();
130130
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.