Skip to content

Commit 95f196f

Browse files
committed
minor symfony#10945 [Component][Translation][Loader] Include file path in exception message (skafandri)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes symfony#10945). Discussion ---------- [Component][Translation][Loader] Include file path in exception message | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | on | Fixed tickets | | License | MIT | Doc PR | When Translation component tryes to load an invalid YAML file, you get InvalidResourceException: Error parsing YAML. Which is not very helpful, I spent 1 hour looking for the invalid file, I think is better to include the file path in the exception message. Commits ------- 3d576ef Include file path in exception
2 parents 4eb4a60 + 3d576ef commit 95f196f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function load($resource, $locale, $domain = 'messages')
5050
try {
5151
$messages = $this->yamlParser->parse(file_get_contents($resource));
5252
} catch (ParseException $e) {
53-
throw new InvalidResourceException('Error parsing YAML.', 0, $e);
53+
throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
5454
}
5555

5656
// empty file

0 commit comments

Comments
 (0)