libpqxx  v4.0-1
C++ library for PostgreSQL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pqxx::usage_error Class Reference

Error in usage of libpqxx library, similar to std::logic_error. More...

#include <except.hxx>

Inheritance diagram for pqxx::usage_error:
Collaboration diagram for pqxx::usage_error:

Public Member Functions

 usage_error (const PGSTD::string &)
 

Private Member Functions

virtual const PGSTD::exception & base () const throw ()
 Return std::exception base-class object. More...
 

Detailed Description

Error in usage of libpqxx library, similar to std::logic_error.

Constructor & Destructor Documentation

pqxx::usage_error::usage_error ( const PGSTD::string &  )
explicit

Member Function Documentation

virtual const PGSTD::exception& pqxx::usage_error::base ( ) const throw ()
inlineprivatevirtual

Return std::exception base-class object.

Use this to get at the exception's what() function, or to downcast to a more specific type using dynamic_cast.

Casting directly from pqxx_exception to a specific exception type is not likely to work since pqxx_exception is not (and could not safely be) derived from std::exception.

For example, to test dynamically whether an exception is an sql_error:

try
{
// ...
}
catch (const pqxx::pqxx_exception &e)
{
std::cerr << e.base().what() << std::endl;
const pqxx::sql_error *s=dynamic_cast<const pqxx::sql_error*>(&e.base());
if (s) std::cerr << "Query was: " << s->query() << std::endl;
}

Implements pqxx::pqxx_exception.


The documentation for this class was generated from the following file: