8000 [DependencyInjection] forward the parse error to the calling code by xabbuh · Pull Request #29928 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DependencyInjection] forward the parse error to the calling code #29928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
forward the parse error to the calling code
  • Loading branch information
xabbuh committed Jan 20, 2019
commit c5c2d31fefb1796af91ab0e83da29098720acf57
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
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