简体   繁体   中英

ParseException error code getting lost when being sent to react-native layer

我一直在测试使用解析来处理过期会话并尝试捕获错误并将其发送到react-native层,但是我遇到的问题是代码返回为'EUNSPECIFIED'而不是'200'在iOS上,我的解决方案是以下用于处理错误的函数,但是如果有人有更好的解决方案,请告诉我。

private static void handleError(Promise promise, Exception error) {
    if (error instanceof  ParseException) {
        ParseException exception = (ParseException) error;
        promise.reject(Integer.toString(exception.getCode()), exception.getMessage(), exception.getCause());
    }
    else promise.reject(error);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM