8000 [DX] Show the ParseException message in YAML file loaders · symfony/symfony@d57b602 · GitHub
[go: up one dir, main page]

Skip to content

Commit d57b602

Browse files
committed
[DX] Show the ParseException message in YAML file loaders
1 parent 62565a1 commit d57b602

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

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

Lines 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), 0, $e);
69+
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: '.$e->getMessage(), $path), 0, $e);
7070
} finally {
7171
restore_error_handler();
7272
}

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

Lines 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('Error parsing YAML, invalid file "%s".', $resource), 0, $e);
50+
throw new InvalidResourceException(sprintf('The file "%s" does not contain valid YAML: '.$e->getMessage(), $resource), 0, $e);
5151
} finally {
5252
restore_error_handler();
5353
}

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

Lines 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), 0, $e);
127+
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: '.$e->getMessage(), $path), 0, $e);
128128
} finally {
129129
restore_error_handler();
130130
}

0 commit comments

Comments
 (0)
0