better error message if channel is in an error state

This commit is contained in:
Emiel Bruijntjes 2017-03-02 12:09:08 +01:00
parent 5ccfd858d1
commit d3c0ea293b
1 changed files with 13 additions and 1 deletions

View File

@ -218,8 +218,20 @@ public:
// store callback
_errorCallback = callback;
// if the channel is connected, all is ok
if (connected()) return;
// is the channel closing down?
if (_state == state_closing) return callback("Channel is closing down");
// the channel is closed, but what is the connection doing?
if (_connection == nullptr) return callback("Channel is not linked to a connection");
// if the connection is valid, this is a pure channel error
if (_connection->connected()) return callback("Channel is in an error state, but the connection is valid");
// direct call if channel is already in error state
if (!connected()) callback("Channel is in error state");
callback("Channel is in error state because no AMQP connection is available");
}
/**