aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-10-22 10:55:07 +0200
committerAdrian Kummerlaender2019-10-22 10:55:07 +0200
commit54efae7153dd9a6ef1768ff3a054c082e090b4ca (patch)
treefd91aa0dc49c01c044a287b35ba892dab6e7e1ca
parentc27ee89f265f73fa77ec043e4f2a52c5c3859965 (diff)
downloadboltzgen-54efae7153dd9a6ef1768ff3a054c082e090b4ca.tar
boltzgen-54efae7153dd9a6ef1768ff3a054c082e090b4ca.tar.gz
boltzgen-54efae7153dd9a6ef1768ff3a054c082e090b4ca.tar.bz2
boltzgen-54efae7153dd9a6ef1768ff3a054c082e090b4ca.tar.lz
boltzgen-54efae7153dd9a6ef1768ff3a054c082e090b4ca.tar.xz
boltzgen-54efae7153dd9a6ef1768ff3a054c082e090b4ca.tar.zst
boltzgen-54efae7153dd9a6ef1768ff3a054c082e090b4ca.zip
Return error for unavailable templates
-rw-r--r--boltzgen/kernel/generator.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/boltzgen/kernel/generator.py b/boltzgen/kernel/generator.py
index 5853561..42d0430 100644
--- a/boltzgen/kernel/generator.py
+++ b/boltzgen/kernel/generator.py
@@ -1,6 +1,7 @@
import sympy
from mako.template import Template
+
from pathlib import Path
class Generator:
@@ -11,7 +12,11 @@ class Generator:
self.boundary = boundary
def kernel(self, target, precision, geometry):
- return Template(filename = str(Path(__file__).parent/('template/basic.' + target + '.mako'))).render(
+ template_path = Path(__file__).parent/('template/basic.' + target + '.mako')
+ if not template_path.exists():
+ raise Exception("Target '%s' not supported" % target)
+
+ return Template(filename = str(template_path)).render(
descriptor = self.descriptor,
geometry = geometry,