libpqxx
|
Mixin base class to identify libpqxx-specific exception types. More...
#include <except.hxx>
Public Member Functions | |
virtual | ~pqxx_exception () noexcept=0 |
Support run-time polymorphism, and keep this class abstract. More... | |
virtual PQXX_CONST const std::exception & | base () const noexcept=0 |
Return std::exception base-class object. More... | |
Mixin base class to identify libpqxx-specific exception types.
If you wish to catch all exception types specific to libpqxx for some reason, catch this type. All of libpqxx's exception classes are derived from it through multiple-inheritance (they also fit into the standard library's exception hierarchy in more fitting places).
This class is not derived from std::exception, since that could easily lead to exception classes with multiple std::exception base-class objects. As Bart Samwel points out, "catch" is subject to some nasty fineprint in such cases.
|
pure virtualnoexcept |
Support run-time polymorphism, and keep this class abstract.
Implementation of libpqxx exception classes.
Copyright (c) 2000-2019, Jeroen T. Vermeulen.
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.
|
pure virtualnoexcept |
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: