diff options
-rw-r--r-- | p2pvr/daemon/sqlSelectDeserializer.cpp | 6 | ||||
-rw-r--r-- | p2pvr/daemon/sqlSelectDeserializer.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/p2pvr/daemon/sqlSelectDeserializer.cpp b/p2pvr/daemon/sqlSelectDeserializer.cpp index 8217f1e..3f011a4 100644 --- a/p2pvr/daemon/sqlSelectDeserializer.cpp +++ b/p2pvr/daemon/sqlSelectDeserializer.cpp @@ -103,7 +103,7 @@ SqlSelectDeserializer::DeserializeSimple(Slicer::ModelPartPtr mp) { auto fmp = mp->GetAnonChild(); if (!cmd.fetch()) { - std::invalid_argument("No rows returned"); + throw NoRowsReturned(); } SqlSourcePtr h = new SqlSource(); const DB::Column & c = cmd[0]; @@ -114,7 +114,7 @@ SqlSelectDeserializer::DeserializeSimple(Slicer::ModelPartPtr mp) fmp->Complete(); } if (cmd.fetch()) { - std::invalid_argument("Too many rows returned"); + throw std::invalid_argument("Too many rows returned"); } } @@ -132,7 +132,7 @@ void SqlSelectDeserializer::DeserializeObject(Slicer::ModelPartPtr mp) { if (!cmd.fetch()) { - throw std::invalid_argument("No rows returned"); + throw NoRowsReturned(); } DeserializeRow(mp); if (cmd.fetch()) { diff --git a/p2pvr/daemon/sqlSelectDeserializer.h b/p2pvr/daemon/sqlSelectDeserializer.h index 008a87c..0c32811 100644 --- a/p2pvr/daemon/sqlSelectDeserializer.h +++ b/p2pvr/daemon/sqlSelectDeserializer.h @@ -4,6 +4,8 @@ #include <slicer/serializer.h> #include <selectcommand.h> +class NoRowsReturned : public std::exception { }; + class SqlSelectDeserializer : public Slicer::Deserializer { public: SqlSelectDeserializer(DB::SelectCommand &, IceUtil::Optional<std::string> typeIdCol = IceUtil::Optional<std::string>()); |