Skip to content

Commit 5c8c902

Browse files
committed
forward the parse error to the calling code
1 parent 8f54459 commit 5c8c902

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ private function parseFileToDOM($file)
383383
try {
384384
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
385385
} catch (\InvalidArgumentException $e) {
386-
throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e);
386+
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s', $file, $e->getMessage()), $e->getCode(), $e);
387387
}
388388

389389
$this->validateExtensions($dom, $file);

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ protected function loadFile($file)
666666
try {
667667
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
668668
} catch (ParseException $e) {
669-
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
669+
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s', $file, $e->getMessage()), 0, $e);
670670
} finally {
671671
restore_error_handler();
672672
}

0 commit comments

Comments
 (0)