cubicweb/web/views/ajaxcontroller.py
changeset 12208 159dce89a145
parent 12189 ef46695adb68
child 12263 e9dd37ffa076
--- a/cubicweb/web/views/ajaxcontroller.py	Fri Oct 06 16:59:10 2017 +0200
+++ b/cubicweb/web/views/ajaxcontroller.py	Tue Sep 12 15:05:22 2017 +0200
@@ -73,7 +73,7 @@
 from logilab.common.registry import yes
 from logilab.common.deprecation import deprecated
 
-from cubicweb import ObjectNotFound, NoSelectableObject
+from cubicweb import ObjectNotFound, NoSelectableObject, ValidationError
 from cubicweb.appobject import AppObject
 from cubicweb.utils import json, json_dumps, UStringIO
 from cubicweb.uilib import exc_message
@@ -153,6 +153,9 @@
             result = func(*args)
         except (RemoteCallFailed, DirectResponse):
             raise
+        except ValidationError:
+            raise RemoteCallFailed(exc_message(exc, self._cw.encoding),
+                                   status=http_client.BAD_REQUEST)
         except Exception as exc:
             if debug_mode:
                 self.exception(