Skip to content

Commit

Permalink
forward the parse error to the calling code
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jan 20, 2019
1 parent 8f54459 commit 5c8c902
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Loader/XmlFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private function parseFileToDOM($file)
try {
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
} catch (\InvalidArgumentException $e) {
throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e);
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s', $file, $e->getMessage()), $e->getCode(), $e);
}

$this->validateExtensions($dom, $file);
Expand Down
2 changes: 1 addition & 1 deletion Loader/YamlFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ protected function loadFile($file)
try {
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
} catch (ParseException $e) {
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s', $file, $e->getMessage()), 0, $e);
} finally {
restore_error_handler();
}
Expand Down

0 comments on commit 5c8c902

Please sign in to comment.