From b38fc54154a23350523173003f1da5f8d39f77b8 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Thu, 25 Jun 2015 20:02:40 -0500
Subject: [PATCH] Catch TypeErrors on Val arguments

---
 gen_wrap.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gen_wrap.py b/gen_wrap.py
index 8cca026..e13fb57 100644
--- a/gen_wrap.py
+++ b/gen_wrap.py
@@ -982,6 +982,10 @@ def write_method_wrapper(gen, cls_name, meth):
                         raise Error("isl_val_int_from_si failed")
 
                     {val_name} = _instantiate(Val, _cdata_{name})
+
+                else:
+                    raise IslTypeError("{name} is a %s and cannot "
+                        "be cast to a Val" % type({name}))
                 """
                 .format(
                     arg0_name=meth.args[0].name,
-- 
GitLab