Derive OrmException from std::runtime_error.
authorgregor herrmann <gregor@toastfreeware.priv.at>
Sun, 27 Aug 2017 20:57:06 +0000 (22:57 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Sun, 27 Aug 2017 20:57:06 +0000 (22:57 +0200)
src/orm/ormrecord.h

index 0dec7aad724aae9a0c25bb0ab5960057a14a0929..30f569a947d2afe0fd905f51b36d44d08a14764d 100644 (file)
 #include <QStringList>
 #include <QDateTime>
 #include <QDebug>
+#include <stdexcept>
 
-class OrmException
+class OrmException : public std::runtime_error
 {
 public:
-    OrmException(const QString& text) : mText(text) {}
+    OrmException(const QString& text) : std::runtime_error(text.toStdString()), mText(text) {}
     virtual ~OrmException(){}
     virtual const QString& text() const { return mText; }
 private:
@@ -41,7 +42,7 @@ private:
 class OrmNoObjectException : public OrmException
 {
 public:
-    OrmNoObjectException() : OrmException("No object exception"){}
+    OrmNoObjectException() : OrmException("SQL query expects one record but found none."){}
     ~OrmNoObjectException(){}
 };