libpqxx  7.7.3
pqxx::errorhandler Class Referenceabstract

Base class for error-handler callbacks. More...

#include <errorhandler.hxx>

Inheritance diagram for pqxx::errorhandler:

Public Member Functions

 errorhandler (connection &)
virtual ~errorhandler ()
virtual bool operator() (char const msg[]) noexcept=0
 errorhandler ()=delete
 errorhandler (errorhandler const &)=delete
errorhandleroperator= (errorhandler const &)=delete


class internal::gate::errorhandler_connection

Detailed Description

Base class for error-handler callbacks.

To receive errors and warnings from a connection, subclass this with your own error-handler functor, and instantiate it for the connection. Destroying the handler un-registers it.

A connection can have multiple error handlers at the same time. When the database connection emits an error or warning message, it passes the message to each error handler, starting with the most recently registered one and progressing towards the oldest one. However an error handler may also instruct the connection not to pass the message to further handlers by returning "false."

Strange things happen when a result object outlives its parent connection. If you register an error handler on a connection, then you must not access the result after destroying the connection. This applies even if you destroy the error handler first!

Constructor & Destructor Documentation

◆ errorhandler() [1/3]

pqxx::errorhandler::errorhandler ( connection conn)

Implementation of pqxx::errorhandler and helpers.

pqxx::errorhandler allows programs to receive errors and warnings.

Copyright (c) 2000-2022, 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.

◆ ~errorhandler()

pqxx::errorhandler::~errorhandler ( )

◆ errorhandler() [2/3]

pqxx::errorhandler::errorhandler ( )

◆ errorhandler() [3/3]

pqxx::errorhandler::errorhandler ( errorhandler const &  )

Member Function Documentation

◆ operator()()

virtual bool pqxx::errorhandler::operator() ( char const  msg[])
pure virtualnoexcept

Define in subclass: receive an error or warning message from the database.

Whether the same error message should also be passed to the remaining, older errorhandlers.

Implemented in pqxx::quiet_errorhandler.

◆ operator=()

errorhandler& pqxx::errorhandler::operator= ( errorhandler const &  )

Friends And Related Function Documentation

◆ internal::gate::errorhandler_connection

friend class internal::gate::errorhandler_connection

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