From 54efae7153dd9a6ef1768ff3a054c082e090b4ca Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 22 Oct 2019 10:55:07 +0200 Subject: Return error for unavailable templates --- boltzgen/kernel/generator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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, -- cgit v1.2.3