Skip to content

Commit

Permalink
Catch and throw proper exception
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioribeiro committed Sep 22, 2018
1 parent 7d5eb9b commit 0c704b6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/package/Support/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class Parser
{
/**
* Dump array to yaml.
* Dump array to yaml.InvalidYamlFile
*
* @param $input
* @param int $inline
Expand Down Expand Up @@ -70,9 +70,13 @@ public function checkYaml($contents)
*/
public function parseFile($filename, $flags = 0)
{
return $this->checkYaml(
(new SymfonyParser())->parseFile($filename, $flags)
);
try {
return $this->checkYaml(
(new SymfonyParser())->parseFile($filename, $flags)
);
} catch (\Symfony\Component\Yaml\Exception\ParseException $exception) {
throw new InvalidYamlFile();
}
}

/**
Expand Down

0 comments on commit 0c704b6

Please sign in to comment.