Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

错误日志功能完善建议! #204

Open
wind417588 opened this issue May 27, 2020 · 0 comments
Open

错误日志功能完善建议! #204

wind417588 opened this issue May 27, 2020 · 0 comments

Comments

@wind417588
Copy link

bool setCounter(void *c, const char *faceset_id)
{
acl::redis_client_pool *pool = (acl::redis_client_pool *)c;
acl::redis_client *conn;
conn = (acl::redis_client *)pool->peek();

if (conn == NULL)
{

    printf("GET redis failed: %s\n", faceset_id);
    return 0;
}

acl::redis_string counter;
counter.set_client(conn);

acl::string key;
key.format("faceset_rows_%s", faceset_id);
if (counter.incrby(key.c_str(), 1, NULL) != true)
{
	printf("Set counter failure. Reason: %s, key: %s\n", counter.result_error(), key.c_str());
	return false;
}

counter.clear();

return true;

}
这段代码是正常的。

但是如果对于一个不熟悉、或者不了解acl::redis的用户来说,直接使用下面这块代码(缺少从连接池申请链接),incrby函数执行失败,但是conter.result_error()输出的错误信息却是空的。这点让人很是抓狂的,希望能够完善。
acl::redis_string counter;
acl::string key;
key.format("faceset_rows_%s", faceset_id);
if (counter.incrby(key.c_str(), 1, NULL) != true)
{
printf("Set counter failure. Reason: %s, key: %s\n", counter.result_error(), key.c_str());
return false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant