diff --git a/src/app_service/service/chat/async_tasks.nim b/src/app_service/service/chat/async_tasks.nim index 6f6262c222..1a93ee5a6c 100644 --- a/src/app_service/service/chat/async_tasks.nim +++ b/src/app_service/service/chat/async_tasks.nim @@ -6,13 +6,18 @@ type const asyncGetChannelGroupsTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} = let arg = decode[AsyncGetChannelGroupsTaskArg](argEncoded) + try: + let response = status_chat.getChannelGroups() - let response = status_chat.getChannelGroups() - - let responseJson = %*{ - "channelGroups": response.result - } - arg.finish(responseJson) + let responseJson = %*{ + "channelGroups": response.result, + "error": "", + } + arg.finish(responseJson) + except Exception as e: + arg.finish(%* { + "error": e.msg, + }) type AsyncCheckChannelPermissionsTaskArg = ref object of QObjectTaskArg diff --git a/src/app_service/service/chat/service.nim b/src/app_service/service/chat/service.nim index ad8486a9d2..2427f91009 100644 --- a/src/app_service/service/chat/service.nim +++ b/src/app_service/service/chat/service.nim @@ -240,6 +240,9 @@ QtObject: try: let rpcResponseObj = response.parseJson + if (rpcResponseObj{"error"}.kind != JNull and rpcResponseObj{"error"}.getStr != ""): + raise newException(CatchableError, rpcResponseObj{"error"}.getStr) + if(rpcResponseObj["channelGroups"].kind == JNull): raise newException(RpcException, "No channel groups returned")