Commit 0fa33bd9 authored by jan.koester's avatar jan.koester
Browse files

removed unessary throws

parent d57823a5
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -27,8 +27,6 @@

#include <mutex>

#include <httppp/exception.h>

#include <libpq-fe.h>

#include <database.h>
@@ -42,10 +40,8 @@ namespace dbpp {
        Postgresql(const char *constr) {
            _dbconn = PQconnectdb(constr);
            if (PQstatus(_dbconn) != CONNECTION_OK){
                libhttppp::HTTPException exp;
                exp[libhttppp::HTTPException::Critical] << PQerrorMessage(_dbconn);
                PQfinish(_dbconn);
                throw exp;
                throw PQerrorMessage(_dbconn);
            }
        }

@@ -58,10 +54,8 @@ namespace dbpp {
            int pstate=PQresultStatus(pres);

            if(pstate==PGRES_FATAL_ERROR || pstate==PGRES_BAD_RESPONSE) {
                 libhttppp::HTTPException exp;
                 exp[libhttppp::HTTPException::Critical] << PQerrorMessage(_dbconn);
                 PQclear(pres);
                 throw exp;
                 throw PQerrorMessage(_dbconn);
            }

            res.clear();
+2 −8
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@
#include <iostream>
#include <atomic>

#include <httppp/exception.h>

#include <sqlite3.h>

#include <database.h>
@@ -44,10 +42,8 @@ namespace dbpp {
            while( sqllock.exchange(true, std::memory_order_acquire) );
            int status=sqlite3_open(constr,&_dbconn);
            if (status != SQLITE_OK ){
                libhttppp::HTTPException exp;
                exp[libhttppp::HTTPException::Critical] << sqlite3_errmsg(_dbconn);
                sqlite3_close(_dbconn);
                throw exp;
                throw  sqlite3_errmsg(_dbconn);
            }
            sqllock.store(false);

@@ -90,11 +86,9 @@ namespace dbpp {
                while( ( pcode = sqlite3_step(prep) ) !=SQLITE_DONE ) {

                   if(pcode==SQLITE_ERROR){
                        libhttppp::HTTPException exp;
                        exp[libhttppp::HTTPException::Critical] << sqlite3_errmsg(_dbconn);
                        delete[] ssql;
                        sqllock.store(false);
                        throw exp;
                        throw sqlite3_errmsg(_dbconn);
                    }

                    if(pcode==SQLITE_ROW){