catch and log errors caused by bad json data stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Fri, 02 Apr 2010 14:28:43 +0200
branchstable
changeset 5139 61b607c8571b
parent 5138 18388a897d2a
child 5140 ef1fcd6f48ff
catch and log errors caused by bad json data
web/views/basecontrollers.py
--- a/web/views/basecontrollers.py	Fri Apr 02 13:48:16 2010 +0200
+++ b/web/views/basecontrollers.py	Fri Apr 02 14:28:43 2010 +0200
@@ -276,7 +276,11 @@
         args = self._cw.form.get('arg', ())
         if not isinstance(args, (list, tuple)):
             args = (args,)
-        args = [simplejson.loads(arg) for arg in args]
+        try:
+            args = [simplejson.loads(arg) for arg in args]
+        except ValueError, exc:
+            self.exception('error while decoding json arguments for js_%s: %s', fname, args, exc)
+            raise RemoteCallFailed(repr(exc)
         try:
             result = func(*args)
         except RemoteCallFailed: