[ipgen] Throw TemplateError to make it easier to catch
When rendering templates we use code which catches the TemplateError to
then report more details about it, since that's an error we know how to
deal with better than with arbitrary other exceptions. Use this
exception in more places.
Signed-off-by: Philipp Wagner <phw@lowrisc.org>
diff --git a/util/ipgen/renderer.py b/util/ipgen/renderer.py
index b4840ac..9ad1487 100644
--- a/util/ipgen/renderer.py
+++ b/util/ipgen/renderer.py
@@ -203,7 +203,7 @@
with open(hjson_path, 'r') as f:
return f.read()
except FileNotFoundError:
- raise FileNotFoundError(
+ raise TemplateRenderError(
"Neither a IP description template at {}, "
"nor an IP description at {} exist!".format(
hjson_tpl_path, hjson_path))