Skip to content

Commit 2be44b9

Browse files
Merge branch '2.3' into 2.7
* 2.3: [Validator] Added Swedish translations improve exceptions when parsing malformed files Dispatch console.terminate *after* console.exception Conflicts: src/Symfony/Component/Console/Application.php src/Symfony/Component/Console/Tests/ApplicationTest.php src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf
2 parents 20b1378 + 6dc51cf commit 2be44b9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Loader/YamlFileLoader.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Routing\RouteCollection;
1515
use Symfony\Component\Routing\Route;
1616
use Symfony\Component\Config\Resource\FileResource;
17+
use Symfony\Component\Yaml\Exception\ParseException;
1718
use Symfony\Component\Yaml\Parser as YamlParser;
1819
use Symfony\Component\Config\Loader\FileLoader;
1920

@@ -60,7 +61,11 @@ public function load($file, $type = null)
6061
$this->yamlParser = new YamlParser();
6162
}
6263

63-
$config = $this->yamlParser->parse(file_get_contents($path));
64+
try {
65+
$config = $this->yamlParser->parse(file_get_contents($path));
66+
} catch (ParseException $e) {
67+
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
68+
}
6469

6570
$collection = new RouteCollection();
6671
$collection->addResource(new FileResource($path));

0 commit comments

Comments
 (0)