{auto} when wrapping a tagger around a channel that already has an error-callback installed, we should preserve the old callback
This commit is contained in:
parent
84a87d8f93
commit
a37c354bea
|
|
@ -207,6 +207,14 @@ public:
|
|||
// connection is gone
|
||||
_connection = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose the currently installed callbacks
|
||||
* @return ErrorCallback
|
||||
*/
|
||||
const ErrorCallback &onError() const { return _errorCallback; }
|
||||
const SuccessCallback &onReady() const { return _readyCallback; }
|
||||
|
||||
|
||||
/**
|
||||
* Callback that is called when the channel was succesfully created.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Implementation for Tagger class.
|
||||
*
|
||||
* @author Michael van der Werve <michael.vanderwerve@mailerq.com>
|
||||
* @copyright 2020 Copernica BV
|
||||
* @copyright 2020 - 2023 Copernica BV
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -34,6 +34,9 @@ Tagger::Tagger(Channel &channel) : _implementation(channel._implementation)
|
|||
// we might have failed, in which case we throw
|
||||
if (!deferred) throw std::runtime_error("could not enable publisher confirms");
|
||||
|
||||
// remember the original callback
|
||||
_errorCallback = _implementation->onError();
|
||||
|
||||
// we wrap a handling error callback that calls our member function
|
||||
_implementation->onError([this](const char *message) { reportError(message); });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue