summaryrefslogtreecommitdiffstats
path: root/client/red_channel.cpp
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-10-25 14:17:32 +0200
committerAlon Levy <alevy@redhat.com>2010-10-25 14:59:12 +0200
commitb4a776b03f2716a179387408909b4da21617e6b5 (patch)
treeea6f3b525f751e26212be6f065a3e438f78dfce6 /client/red_channel.cpp
parentd9ea4242b13d2014c68f735cc9f77fc63066592b (diff)
downloadspice-b4a776b03f2716a179387408909b4da21617e6b5.tar.gz
spice-b4a776b03f2716a179387408909b4da21617e6b5.tar.xz
spice-b4a776b03f2716a179387408909b4da21617e6b5.zip
client: add verbose link error messages
Diffstat (limited to 'client/red_channel.cpp')
-rw-r--r--client/red_channel.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/client/red_channel.cpp b/client/red_channel.cpp
index 54caccf7..273b28dd 100644
--- a/client/red_channel.cpp
+++ b/client/red_channel.cpp
@@ -42,6 +42,23 @@ RedChannelBase::~RedChannelBase()
{
}
+const char *spice_link_error_string(int err)
+{
+ switch (err) {
+ case SPICE_LINK_ERR_OK: return "no error";
+ case SPICE_LINK_ERR_ERROR: return "general error";
+ case SPICE_LINK_ERR_INVALID_MAGIC: return "invalid magic";
+ case SPICE_LINK_ERR_INVALID_DATA: return "invalid data";
+ case SPICE_LINK_ERR_VERSION_MISMATCH: return "version mismatch";
+ case SPICE_LINK_ERR_NEED_SECURED: return "need secured connection";
+ case SPICE_LINK_ERR_NEED_UNSECURED: return "need unsecured connection";
+ case SPICE_LINK_ERR_PERMISSION_DENIED: return "permission denied";
+ case SPICE_LINK_ERR_BAD_CONNECTION_ID: return "bad connection id";
+ case SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE: return "channel not available";
+ }
+ return "";
+}
+
void RedChannelBase::link(uint32_t connection_id, const std::string& password,
int protocol)
{
@@ -124,7 +141,8 @@ void RedChannelBase::link(uint32_t connection_id, const std::string& password,
reply = (SpiceLinkReply *)reply_buf.get();
if (reply->error != SPICE_LINK_ERR_OK) {
- THROW_ERR(SPICEC_ERROR_CODE_CONNECT_FAILED, "connect error %u", reply->error);
+ THROW_ERR(SPICEC_ERROR_CODE_CONNECT_FAILED, "connect error %u - %s",
+ reply->error, spice_link_error_string(reply->error));
}
uint32_t num_caps = reply->num_channel_caps + reply->num_common_caps;