cubicweb/_exceptions.py
changeset 12614 8ac9ac8d9143
parent 12613 703a263dd618
--- a/cubicweb/_exceptions.py	Thu May 16 09:40:28 2019 +0200
+++ b/cubicweb/_exceptions.py	Thu May 16 04:42:59 2019 +0200
@@ -107,9 +107,14 @@
 
 
 class ViolatedConstraint(RepositoryError):
-    def __init__(self, cnx, cstrname):
+    def __init__(self, cnx, cstrname, query):
         self.cnx = cnx
         self.cstrname = cstrname
+        message = (
+            "constraint '%s' is being violated by the query '%s'. "
+            "You can run the inverted constraint on the database to list the problematic rows."
+        ) % (cstrname, query)
+        super(ViolatedConstraint, self).__init__(message)
 
 
 # security exceptions #########################################################