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

decode错误时提示Error类型 #38

Open
xiezhaokai opened this issue Mar 20, 2023 · 1 comment
Open

decode错误时提示Error类型 #38

xiezhaokai opened this issue Mar 20, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@xiezhaokai
Copy link
Contributor

是否考虑在decode出错时增加 Error Enum 类型。来表示诸如 "值类型错误/ErrorValueType",“缺少必须的域/MissingmandatoryFiled”等解析错误?

或者将rapidxml/rapidJson 解析时的返回值透传回来,类似如下

 bool isSuccess = false;
    try
    {
        isSuccess = xpack::json::decode(content.toStdString(), j);
    }
    catch (const std::exception& e)
    {
        LOGERROR("decode error ");
    }

    return isSuccess;
@xyz347 xyz347 added the enhancement New feature or request label Mar 23, 2023
@jiang443
Copy link

jiang443 commented Nov 9, 2023

同理,字符串类型的jasonvalue “0” 与数字类型的jasonvalue 0, 经常被混用,很容易造成异常。
如果能处理自动转换,使用默认数值,不要崩溃,就会更加适应生产环境。

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

No branches or pull requests

3 participants