Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

except.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  *   FILE
00004  *      pqxx/except.h
00005  *
00006  *   DESCRIPTION
00007  *      definition of libpqxx exception classes
00008  *   pqxx::sql_error, pqxx::broken_connection, pqxx::in_doubt_error, ...
00009  *
00010  * Copyright (c) 2003, Jeroen T. Vermeulen <jtv@xs4all.nl>
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef PQXX_EXCEPT_H
00015 #define PQXX_EXCEPT_H
00016 
00017 #include <string>
00018 #include <stdexcept>
00019 
00020 #include "pqxx/util.h"
00021 
00022 
00024 
00025 class PQXX_LIBEXPORT broken_connection : public PGSTD::runtime_error
00026 {
00027 public:
00028   broken_connection() : PGSTD::runtime_error("Connection to back end failed") {}
00029   explicit broken_connection(const PGSTD::string &whatarg) : 
00030     PGSTD::runtime_error(whatarg) {}
00031 };
00032 
00033 
00035 
00036 class PQXX_LIBEXPORT sql_error : public PGSTD::runtime_error
00037 {
00038   PGSTD::string m_Q;
00039 
00040 public:
00041   sql_error() : PGSTD::runtime_error("Failed query"), m_Q() {}
00042   sql_error(const PGSTD::string &whatarg) : 
00043         PGSTD::runtime_error(whatarg), m_Q() {}
00044   sql_error(const PGSTD::string &whatarg, const PGSTD::string &Q) :
00045         PGSTD::runtime_error(whatarg), m_Q(Q) { }
00046   virtual ~sql_error() throw () {}
00047 
00048   const PGSTD::string &query() const { return m_Q; }
00049 };
00050 
00051 
00053 
00059 class PQXX_LIBEXPORT in_doubt_error : public PGSTD::runtime_error
00060 {
00061 public:
00062   explicit in_doubt_error(const PGSTD::string &whatarg) : 
00063         PGSTD::runtime_error(whatarg) {}
00064 };
00065 
00066 
00067 #endif
00068 

Generated on Mon Apr 28 16:37:18 2003 for libpqxx by doxygen1.3-rc3