use a custom exception

This commit is contained in:
Jan Petykiewicz 2024-07-30 22:43:35 -07:00
parent d72c5e254f
commit c3646b2fd2

View File

@ -25,6 +25,11 @@ from .csr import CSRMatrix
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class FDFDError(Exception):
""" Custom error for opencl_fdfd """
pass
# Create jinja2 env on module load # Create jinja2 env on module load
jinja_env = jinja2.Environment(loader=jinja2.PackageLoader(__name__, 'kernels')) jinja_env = jinja2.Environment(loader=jinja2.PackageLoader(__name__, 'kernels'))
@ -52,7 +57,7 @@ def type_to_C(
numpy.complex128: 'cdouble_t', numpy.complex128: 'cdouble_t',
} }
if float_type not in types: if float_type not in types:
raise Exception('Unsupported type') raise FDFDError('Unsupported type')
return types[float_type] return types[float_type]