Raising exception instead of printing error on bad YAML
authorGreg Wilson <gvwilson@third-bit.com>
Wed, 22 Jun 2016 17:17:02 +0000 (13:17 -0400)
committerGreg Wilson <gvwilson@third-bit.com>
Wed, 22 Jun 2016 17:17:02 +0000 (13:17 -0400)
bin/util.py

index 23245be8a7858d04a0b8e3d89ba1748224439573..cb85cf25340ff00455d79bcd40ceb0b9412c2d23 100644 (file)
@@ -68,8 +68,7 @@ def read_markdown(parser, path):
         try:
             metadata = yaml.load(pieces[1])
         except yaml.YAMLError as e:
-            print('Unable to parse YAML header in {0}:\n{1}'.format(path, e))
-            sys.exit(1)
+            raise ValueError('Unable to parse YAML header in {0}:\n{1}'.format(path, e))
         metadata_len = pieces[1].count('\n')
         body = pieces[2]