messages: use proper multiline error message for rpcrequest and API wrappers

This commit is contained in:
Björn Linse
2019-01-24 19:15:39 +01:00
parent e0348c610c
commit 8ed54bbec3
15 changed files with 136 additions and 30 deletions

View File

@@ -687,6 +687,22 @@ Dictionary rpc_client_info(Channel *chan)
return copy_dictionary(chan->rpc.info);
}
const char *rpc_client_name(Channel *chan)
{
if (!chan->is_rpc) {
return NULL;
}
Dictionary info = chan->rpc.info;
for (size_t i = 0; i < info.size; i++) {
if (strequal("name", info.items[i].key.data)
&& info.items[i].value.type == kObjectTypeString) {
return info.items[i].value.data.string.data;
}
}
return NULL;
}
#if MIN_LOG_LEVEL <= DEBUG_LOG_LEVEL
#define REQ "[request] "
#define RES "[response] "