diff --git a/include/sqlpp11/postgresql/exception.h b/include/sqlpp11/postgresql/exception.h index f6a86428..30ed6d2b 100644 --- a/include/sqlpp11/postgresql/exception.h +++ b/include/sqlpp11/postgresql/exception.h @@ -288,6 +288,28 @@ namespace sqlpp } }; + class DLL_PUBLIC serialization_failure : public sql_error + { + public: + explicit serialization_failure(std::string err) : sql_error{std::move(err)} + { + } + serialization_failure(std::string err, std::string Q) : sql_error{std::move(err), std::move(Q)} + { + } + }; + + class DLL_PUBLIC deadlock_detected : public sql_error + { + public: + explicit deadlock_detected(std::string err) : sql_error{std::move(err)} + { + } + deadlock_detected(std::string err, std::string Q) : sql_error{std::move(err), std::move(Q)} + { + } + }; + class DLL_PUBLIC syntax_error : public sql_error { public: diff --git a/include/sqlpp11/postgresql/result.h b/include/sqlpp11/postgresql/result.h index 5d8d8621..b9a1d14c 100644 --- a/include/sqlpp11/postgresql/result.h +++ b/include/sqlpp11/postgresql/result.h @@ -245,6 +245,11 @@ namespace sqlpp case '4': switch (code[1]) { + case '0': + if (strcmp(code, "40001") == 0) + throw serialization_failure{err, query}; + if (strcmp(code, "40P01") == 0) + throw deadlock_detected{err, query}; case '2': if (strcmp(code, "42501") == 0) throw insufficient_privilege{err, query};