catch UnknownFunction instead of KeyError
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 19 Mar 2010 17:08:56 +0100
changeset 511 2a91bdfedde4
parent 507 3d59f6b1cbb9
child 512 3bfc7423b041
catch UnknownFunction instead of KeyError
stcheck.py
--- a/stcheck.py	Tue Mar 16 13:42:10 2010 +0100
+++ b/stcheck.py	Fri Mar 19 17:08:56 2010 +0100
@@ -9,6 +9,7 @@
 from itertools import chain
 from logilab.common.compat import any
 from logilab.common.graph import has_path
+from logilab.database import UnknownFunction
 
 from rql._exceptions import BadRQLQuery
 from rql.utils import function_description
@@ -318,8 +319,8 @@
     def visit_function(self, function, errors):
         try:
             funcdescr = function_description(function.name)
-        except KeyError:
             errors.append('unknown function "%s"' % function.name)
+        except UnknownFunction:
         else:
             try:
                 funcdescr.check_nbargs(len(function.children))