except.hxx
/*-------------------------------------------------------------------------
*
* FILE
* pqxx/except.hxx
*
* DESCRIPTION
* definition of libpqxx exception classes
* pqxx::sql_error, pqxx::broken_connection, pqxx::in_doubt_error, ...
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/except instead.
*
* Copyright (c) 2003-2008, Jeroen T. Vermeulen <jtv@xs4all.nl>
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
* or contact the author.
*
*-------------------------------------------------------------------------
*/
#ifndef PQXX_H_EXCEPT
#define PQXX_H_EXCEPT
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include <stdexcept>
#include "pqxx/util"
namespace pqxx
{
class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception
{
public:
virtual ~pqxx_exception() throw () =0;
virtual const PQXX_CONST PGSTD::exception &base() const throw () =0; //[t0]
};
class PQXX_LIBEXPORT failure :
public pqxx_exception, public PGSTD::runtime_error
{
virtual const PGSTD::exception &base() const throw () { return *this; }
public:
explicit failure(const PGSTD::string &);
};
class PQXX_LIBEXPORT broken_connection : public failure
{
public:
broken_connection();
explicit broken_connection(const PGSTD::string &);
};
class PQXX_LIBEXPORT sql_error : public failure
{
PGSTD::string m_Q;
public:
sql_error();
explicit sql_error(const PGSTD::string &);
sql_error(const PGSTD::string &, const PGSTD::string &Q);
virtual ~sql_error() throw ();
const PGSTD::string & PQXX_PURE query() const throw (); //[t56]
};
// TODO: should this be called statement_completion_unknown!?
class PQXX_LIBEXPORT in_doubt_error : public failure
{
public:
explicit in_doubt_error(const PGSTD::string &);
};
class PQXX_LIBEXPORT internal_error :
public pqxx_exception, public PGSTD::logic_error
{
virtual const PGSTD::exception &base() const throw () { return *this; }
public:
explicit internal_error(const PGSTD::string &);
};
class PQXX_LIBEXPORT usage_error :
public pqxx_exception, public PGSTD::logic_error
{
virtual const PGSTD::exception &base() const throw () { return *this; }
public:
explicit usage_error(const PGSTD::string &);
};
class PQXX_LIBEXPORT argument_error :
public pqxx_exception, public PGSTD::invalid_argument
{
virtual const PGSTD::exception &base() const throw () { return *this; }
public:
explicit argument_error(const PGSTD::string &);
};
class PQXX_LIBEXPORT conversion_error :
public pqxx_exception, public PGSTD::domain_error
{
virtual const PGSTD::exception &base() const throw () { return *this; }
public:
explicit conversion_error(const PGSTD::string &);
};
class PQXX_LIBEXPORT range_error :
public pqxx_exception, public PGSTD::out_of_range
{
virtual const PGSTD::exception &base() const throw () { return *this; }
public:
explicit range_error(const PGSTD::string &);
};
class PQXX_LIBEXPORT feature_not_supported : public sql_error
{
public:
explicit feature_not_supported(const PGSTD::string &err) : sql_error(err) {}
feature_not_supported(const PGSTD::string &err, const PGSTD::string &Q) :
sql_error(err,Q) {}
};
class PQXX_LIBEXPORT data_exception : public sql_error
{
public:
explicit data_exception(const PGSTD::string &err) : sql_error(err) {}
data_exception(const PGSTD::string &err, const PGSTD::string &Q) :
sql_error(err,Q) {}
};
class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error
{
public:
explicit integrity_constraint_violation(const PGSTD::string &err) :
sql_error(err) {}
integrity_constraint_violation(const PGSTD::string &err,
const PGSTD::string &Q) :
sql_error(err, Q) {}
};
class PQXX_LIBEXPORT restrict_violation :
public integrity_constraint_violation
{
public:
explicit restrict_violation(const PGSTD::string &err) :
integrity_constraint_violation(err) {}
restrict_violation(const PGSTD::string &err,
const PGSTD::string &Q) :
integrity_constraint_violation(err, Q) {}
};
class PQXX_LIBEXPORT not_null_violation :
public integrity_constraint_violation
{
public:
explicit not_null_violation(const PGSTD::string &err) :
integrity_constraint_violation(err) {}
not_null_violation(const PGSTD::string &err,
const PGSTD::string &Q) :
integrity_constraint_violation(err, Q) {}
};
class PQXX_LIBEXPORT foreign_key_violation :
public integrity_constraint_violation
{
public:
explicit foreign_key_violation(const PGSTD::string &err) :
integrity_constraint_violation(err) {}
foreign_key_violation(const PGSTD::string &err,
const PGSTD::string &Q) :
integrity_constraint_violation(err, Q) {}
};
class PQXX_LIBEXPORT unique_violation :
public integrity_constraint_violation
{
public:
explicit unique_violation(const PGSTD::string &err) :
integrity_constraint_violation(err) {}
unique_violation(const PGSTD::string &err,
const PGSTD::string &Q) :
integrity_constraint_violation(err, Q) {}
};
class PQXX_LIBEXPORT check_violation :
public integrity_constraint_violation
{
public:
explicit check_violation(const PGSTD::string &err) :
integrity_constraint_violation(err) {}
check_violation(const PGSTD::string &err,
const PGSTD::string &Q) :
integrity_constraint_violation(err, Q) {}
};
class PQXX_LIBEXPORT invalid_cursor_state : public sql_error
{
public:
explicit invalid_cursor_state(const PGSTD::string &err) : sql_error(err) {}
invalid_cursor_state(const PGSTD::string &err, const PGSTD::string &Q) :
sql_error(err,Q) {}
};
class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error
{
public:
explicit invalid_sql_statement_name(const PGSTD::string &err) :
sql_error(err) {}
invalid_sql_statement_name(const PGSTD::string &err, const PGSTD::string &Q) :
sql_error(err,Q) {}
};
class PQXX_LIBEXPORT invalid_cursor_name : public sql_error
{
public:
explicit invalid_cursor_name(const PGSTD::string &err) : sql_error(err) {}
invalid_cursor_name(const PGSTD::string &err, const PGSTD::string &Q) :
sql_error(err,Q) {}
};
class PQXX_LIBEXPORT syntax_error : public sql_error
{
public:
const int error_position;
explicit syntax_error(const PGSTD::string &err, int pos=-1) :
sql_error(err), error_position(pos) {}
syntax_error(const PGSTD::string &err, const PGSTD::string &Q, int pos=-1) :
sql_error(err,Q), error_position(pos) {}
};
class PQXX_LIBEXPORT undefined_column : public syntax_error
{
public:
explicit undefined_column(const PGSTD::string &err) : syntax_error(err) {}
undefined_column(const PGSTD::string &err, const PGSTD::string &Q) :
syntax_error(err, Q) {}
};
class PQXX_LIBEXPORT undefined_function : public syntax_error
{
public:
explicit undefined_function(const PGSTD::string &err) : syntax_error(err) {}
undefined_function(const PGSTD::string &err, const PGSTD::string &Q) :
syntax_error(err, Q) {}
};
class PQXX_LIBEXPORT undefined_table : public syntax_error
{
public:
explicit undefined_table(const PGSTD::string &err) : syntax_error(err) {}
undefined_table(const PGSTD::string &err, const PGSTD::string &Q) :
syntax_error(err, Q) {}
};
class PQXX_LIBEXPORT insufficient_privilege : public sql_error
{
public:
explicit insufficient_privilege(const PGSTD::string &err) : sql_error(err) {}
insufficient_privilege(const PGSTD::string &err, const PGSTD::string &Q) :
sql_error(err,Q) {}
};
class PQXX_LIBEXPORT insufficient_resources : public sql_error
{
public:
explicit insufficient_resources(const PGSTD::string &err) : sql_error(err) {}
insufficient_resources(const PGSTD::string &err, const PGSTD::string &Q) :
sql_error(err,Q) {}
};
class PQXX_LIBEXPORT disk_full : public insufficient_resources
{
public:
explicit disk_full(const PGSTD::string &err) : insufficient_resources(err) {}
disk_full(const PGSTD::string &err, const PGSTD::string &Q) :
insufficient_resources(err,Q) {}
};
class PQXX_LIBEXPORT out_of_memory : public insufficient_resources
{
public:
explicit out_of_memory(const PGSTD::string &err) :
insufficient_resources(err) {}
out_of_memory(const PGSTD::string &err, const PGSTD::string &Q) :
insufficient_resources(err,Q) {}
};
class PQXX_LIBEXPORT too_many_connections : public broken_connection
{
public:
explicit too_many_connections(const PGSTD::string &err) :
broken_connection(err) {}
};
class PQXX_LIBEXPORT plpgsql_error : public sql_error
{
public:
explicit plpgsql_error(const PGSTD::string &err) :
sql_error(err) {}
plpgsql_error(const PGSTD::string &err, const PGSTD::string &Q) :
sql_error(err, Q) {}
};
class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error
{
public:
explicit plpgsql_raise(const PGSTD::string &err) :
plpgsql_error(err) {}
plpgsql_raise(const PGSTD::string &err, const PGSTD::string &Q) :
plpgsql_error(err, Q) {}
};
class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error
{
public:
explicit plpgsql_no_data_found(const PGSTD::string &err) :
plpgsql_error(err) {}
plpgsql_no_data_found(const PGSTD::string &err, const PGSTD::string &Q) :
plpgsql_error(err, Q) {}
};
class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error
{
public:
explicit plpgsql_too_many_rows(const PGSTD::string &err) :
plpgsql_error(err) {}
plpgsql_too_many_rows(const PGSTD::string &err, const PGSTD::string &Q) :
plpgsql_error(err, Q) {}
};
}
#include "pqxx/compiler-internal-post.hxx"
#endif
pqxx::check_violation
Definition: except.hxx:284
pqxx::not_null_violation
Definition: except.hxx:251
pqxx::disk_full::disk_full
disk_full(const std::string &err)
Definition: except.hxx:376
pqxx::pqxx_exception
Mixin base class to identify libpqxx-specific exception types.
Definition: except.hxx:61
pqxx::plpgsql_no_data_found::plpgsql_no_data_found
plpgsql_no_data_found(const std::string &err, const std::string &Q)
Definition: except.hxx:424
pqxx::insufficient_privilege
Definition: except.hxx:356
pqxx::data_exception::data_exception
data_exception(const std::string &err, const std::string &Q)
Definition: except.hxx:226
pqxx::undefined_column
Definition: except.hxx:332
pqxx::invalid_sql_statement_name
Definition: except.hxx:303
pqxx::internal_error
Internal error in libpqxx library.
Definition: except.hxx:164
pqxx::syntax_error::syntax_error
syntax_error(const std::string &err, int pos=-1)
Definition: except.hxx:326
pqxx::plpgsql_error
PL/pgSQL error.
Definition: except.hxx:400
pqxx::data_exception::data_exception
data_exception(const std::string &err)
Definition: except.hxx:225
pqxx::broken_connection
Exception class for lost or failed backend connection.
Definition: except.hxx:123
pqxx::disk_full
Definition: except.hxx:373
pqxx::undefined_table::undefined_table
undefined_table(const std::string &err)
Definition: except.hxx:351
pqxx::undefined_table
Definition: except.hxx:348
pqxx::undefined_function::undefined_function
undefined_function(const std::string &err, const std::string &Q)
Definition: except.hxx:344
pqxx::integrity_constraint_violation::integrity_constraint_violation
integrity_constraint_violation(const std::string &err, const std::string &Q)
Definition: except.hxx:235
pqxx::argument_error
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:184
pqxx::plpgsql_no_data_found
Definition: except.hxx:419
pqxx::foreign_key_violation::foreign_key_violation
foreign_key_violation(const std::string &err, const std::string &Q)
Definition: except.hxx:268
pqxx::in_doubt_error
"Help, I don&#39;t know whether transaction was committed successfully!"
Definition: except.hxx:156
pqxx::too_many_connections
Definition: except.hxx:390
pqxx::not_null_violation::not_null_violation
not_null_violation(const std::string &err, const std::string &Q)
Definition: except.hxx:257
pqxx::invalid_cursor_state::invalid_cursor_state
invalid_cursor_state(const std::string &err)
Definition: except.hxx:298
pqxx::integrity_constraint_violation::integrity_constraint_violation
integrity_constraint_violation(const std::string &err)
Definition: except.hxx:233
pqxx::restrict_violation::restrict_violation
restrict_violation(const std::string &err)
Definition: except.hxx:244
pqxx::out_of_memory::out_of_memory
out_of_memory(const std::string &err, const std::string &Q)
Definition: except.hxx:386
pqxx::data_exception
Error in data provided to SQL statement.
Definition: except.hxx:222
pqxx::conversion_error
Definition: except.hxx:193
pqxx::invalid_cursor_state::invalid_cursor_state
invalid_cursor_state(const std::string &err, const std::string &Q)
Definition: except.hxx:299
pqxx::undefined_column::undefined_column
undefined_column(const std::string &err, const std::string &Q)
Definition: except.hxx:336
pqxx::not_null_violation::not_null_violation
not_null_violation(const std::string &err)
Definition: except.hxx:255
pqxx::check_violation::check_violation
check_violation(const std::string &err)
Definition: except.hxx:288
pqxx::invalid_sql_statement_name::invalid_sql_statement_name
invalid_sql_statement_name(const std::string &err, const std::string &Q)
Definition: except.hxx:308
pqxx::insufficient_privilege::insufficient_privilege
insufficient_privilege(const std::string &err, const std::string &Q)
Definition: except.hxx:360
pqxx::undefined_table::undefined_table
undefined_table(const std::string &err, const std::string &Q)
Definition: except.hxx:352
pqxx::syntax_error::syntax_error
syntax_error(const std::string &err, const std::string &Q, int pos=-1)
Definition: except.hxx:328
pqxx::disk_full::disk_full
disk_full(const std::string &err, const std::string &Q)
Definition: except.hxx:377
pqxx::unique_violation
Definition: except.hxx:273
pqxx::insufficient_resources::insufficient_resources
insufficient_resources(const std::string &err, const std::string &Q)
Definition: except.hxx:369
pqxx::restrict_violation
Definition: except.hxx:240
pqxx::feature_not_supported::feature_not_supported
feature_not_supported(const std::string &err, const std::string &Q)
Definition: except.hxx:217
pqxx::plpgsql_too_many_rows
Definition: except.hxx:428
pqxx::feature_not_supported::feature_not_supported
feature_not_supported(const std::string &err)
Definition: except.hxx:216
pqxx::plpgsql_error::plpgsql_error
plpgsql_error(const std::string &err, const std::string &Q)
Definition: except.hxx:405
pqxx::out_of_memory::out_of_memory
out_of_memory(const std::string &err)
Definition: except.hxx:384
pqxx::unique_violation::unique_violation
unique_violation(const std::string &err, const std::string &Q)
Definition: except.hxx:279
pqxx::syntax_error
Definition: except.hxx:320
pqxx::syntax_error::error_position
const int error_position
Approximate position in string where error occurred, or -1 if unknown.
Definition: except.hxx:324
pqxx::unique_violation::unique_violation
unique_violation(const std::string &err)
Definition: except.hxx:277
pqxx::invalid_cursor_state
Definition: except.hxx:295
pqxx::invalid_cursor_name::invalid_cursor_name
invalid_cursor_name(const std::string &err, const std::string &Q)
Definition: except.hxx:316
pqxx::too_many_connections::too_many_connections
too_many_connections(const std::string &err)
Definition: except.hxx:393
pqxx::plpgsql_too_many_rows::plpgsql_too_many_rows
plpgsql_too_many_rows(const std::string &err, const std::string &Q)
Definition: except.hxx:433
pqxx::check_violation::check_violation
check_violation(const std::string &err, const std::string &Q)
Definition: except.hxx:290
pqxx::failure
Run-time failure encountered by libpqxx, similar to std::runtime_error.
Definition: except.hxx:95
pqxx::insufficient_resources
Resource shortage on the server.
Definition: except.hxx:365
pqxx::feature_not_supported
Database feature not supported in current setup.
Definition: except.hxx:213
pqxx::undefined_function
Definition: except.hxx:340
pqxx::insufficient_privilege::insufficient_privilege
insufficient_privilege(const std::string &err)
Definition: except.hxx:359
pqxx::plpgsql_raise::plpgsql_raise
plpgsql_raise(const std::string &err, const std::string &Q)
Definition: except.hxx:415
pqxx::restrict_violation::restrict_violation
restrict_violation(const std::string &err, const std::string &Q)
Definition: except.hxx:246
pqxx::plpgsql_raise::plpgsql_raise
plpgsql_raise(const std::string &err)
Definition: except.hxx:413
pqxx::invalid_sql_statement_name::invalid_sql_statement_name
invalid_sql_statement_name(const std::string &err)
Definition: except.hxx:306
pqxx::usage_error
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:174
pqxx::undefined_function::undefined_function
undefined_function(const std::string &err)
Definition: except.hxx:343
pqxx::plpgsql_error::plpgsql_error
plpgsql_error(const std::string &err)
Definition: except.hxx:403
pqxx::plpgsql_raise
Exception raised in PL/pgSQL procedure.
Definition: except.hxx:410
pqxx::foreign_key_violation
Definition: except.hxx:262
pqxx::sql_error
Exception class for failed queries.
Definition: except.hxx:133
pqxx::foreign_key_violation::foreign_key_violation
foreign_key_violation(const std::string &err)
Definition: except.hxx:266
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
pqxx::plpgsql_too_many_rows::plpgsql_too_many_rows
plpgsql_too_many_rows(const std::string &err)
Definition: except.hxx:431
pqxx::out_of_memory
Definition: except.hxx:381
pqxx::integrity_constraint_violation
Definition: except.hxx:230
pqxx::plpgsql_no_data_found::plpgsql_no_data_found
plpgsql_no_data_found(const std::string &err)
Definition: except.hxx:422
pqxx::undefined_column::undefined_column
undefined_column(const std::string &err)
Definition: except.hxx:335
pqxx::invalid_cursor_name::invalid_cursor_name
invalid_cursor_name(const std::string &err)
Definition: except.hxx:315
pqxx::range_error
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:203
pqxx::insufficient_resources::insufficient_resources
insufficient_resources(const std::string &err)
Definition: except.hxx:368
pqxx::invalid_cursor_name
Definition: except.hxx:312