TrackInsertException: make error message useful.
authorgregor herrmann <gregor@toastfreeware.priv.at>
Sun, 27 Aug 2017 20:58:18 +0000 (22:58 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Sun, 27 Aug 2017 20:58:18 +0000 (22:58 +0200)
src/mvc/track.cpp

index 6ba24c7..1c563d6 100644 (file)
@@ -39,10 +39,11 @@ public:
 int Track::insert()
 {
     QSqlQuery query;
-    query.prepare("INSERT INTO " + sTableName + " (" + CONFERENCEID + "," + NAME + ")" + " VALUES " + "(\"" + QString::number(conferenceid()) + "\",\"" + name() + "\")");
+    QString trackname = name();
+    query.prepare("INSERT INTO " + sTableName + " (" + CONFERENCEID + "," + NAME + ")" + " VALUES " + "(\"" + QString::number(conferenceid()) + "\",\"" + trackname + "\")");
     if (!query.exec())
     {
-        throw TrackInsertException("Exec Error");
+        throw TrackInsertException("Inserting track '" + trackname + "' into database failed.");
     }
     QVariant variant = query.lastInsertId();
     if (variant.isValid())