Skip to content

Commit 2e78223

Browse files
bug #36501 [DX] Show the ParseException message in all YAML file loaders (fancyweb)
This PR was merged into the 3.4 branch. Discussion ---------- [DX] Show the ParseException message in all YAML file loaders | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR synchronizes the exception message in the Routing, Validator and Translation YAML file loaders with the DependencyInjection YAML file loader behavior. Adding the ParseException message is a big DX gain because it highlights the problem directly instead of having to scroll down 7 previous exceptions. I'm targetting 3.4 because DX can be considered as a bug fix AFAIK. Commits ------- fc6cf3d3c6 [DX] Show the ParseException message in YAML file loaders
2 parents c10416b + a6d40f3 commit 2e78223

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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', $path).': '.$e->getMessage(), 0, $e);
128128
} finally {
129129
restore_error_handler();
130130
}

0 commit comments

Comments
 (0)