Skip to content

Commit 5e96f83

Browse files
Fix exception messages containing exception messages
1 parent 801d058 commit 5e96f83

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Compiler/AbstractRecursivePass.php

Lines 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;

Loader/XmlFileLoader.php

Lines 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);

Loader/YamlFileLoader.php

Lines 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
}

0 commit comments

Comments
 (0)