Skip to content

Commit af97e51

Browse files
committed
Catch pyyaml ScannerError for more meaningful error message
1 parent 8cafbd7 commit af97e51

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/pdfbaker/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def __init__(
4545
try:
4646
with open(config_file, encoding="utf-8") as f:
4747
config = yaml.safe_load(f)
48+
except yaml.scanner.ScannerError as exc:
49+
raise ConfigurationError(
50+
f"Invalid YAML syntax in config file {config_file}: {exc}"
51+
) from exc
4852
except Exception as exc:
4953
raise ConfigurationError(f"Failed to load config file: {exc}") from exc
5054

0 commit comments

Comments
 (0)