From 5114f83b5dc86befe5965784929811a9bbcc654c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 30 Mar 2017 16:19:31 +0100 Subject: [PATCH] Catch error if missing config --- md_pdf/config/read.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/md_pdf/config/read.py b/md_pdf/config/read.py index 2ae0bcd..6d32c95 100644 --- a/md_pdf/config/read.py +++ b/md_pdf/config/read.py @@ -2,8 +2,12 @@ import yaml from dotmap import DotMap import os from md_pdf.consts import CONFIG_FILE +from md_pdf.exceptions import ConfigValidationException def load_config(): - with open(os.path.join(CONFIG_FILE)) as f: - return DotMap(yaml.load(f)) + try: + with open(os.path.join(CONFIG_FILE)) as f: + return DotMap(yaml.load(f)) + except FileNotFoundError: + raise ConfigValidationException("Can't find config file at {}".format(CONFIG_FILE))