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

Invalid argument passed to libpqxx, similar to std::invalid_argument. More...

#include <except.hxx>

Inheritance diagram for pqxx::argument_error:
Collaboration diagram for pqxx::argument_error:

Public Member Functions

 argument_error (const PGSTD::string &)
 

Private Member Functions

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

Detailed Description

Invalid argument passed to libpqxx, similar to std::invalid_argument.

Constructor & Destructor Documentation

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

Member Function Documentation

virtual const PGSTD::exception& pqxx::argument_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: