[server] print backend exception if we fail to execute an sql script
authorJulien Cristau <julien.cristau@logilab.fr>
Fri, 04 Mar 2016 12:17:58 +0100
changeset 11192 ba952f509af6
parent 11191 0c27c0da4094
child 11193 966b9e4e1f72
[server] print backend exception if we fail to execute an sql script It's more useful to see could not open extension control file "/usr/share/postgresql/9.4/extension/postgis.control": No such file or directory rather than merely -> ERROR, skipping /usr/share/cubicweb/cubes/postgis/schema/_ext.postgres.sql
cubicweb/server/sqlutils.py
--- a/cubicweb/server/sqlutils.py	Tue Mar 15 14:59:24 2016 +0100
+++ b/cubicweb/server/sqlutils.py	Fri Mar 04 12:17:58 2016 +0100
@@ -97,7 +97,8 @@
         try:
             # some dbapi modules doesn't accept unicode for sql string
             execute(str(sql))
-        except Exception:
+        except Exception as ex:
+            print(ex, file=sys.stderr)
             if cnx:
                 cnx.rollback()
             failed.append(sql)