TrackInsertException: make error message useful.
[toast/confclerk.git] / 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())