有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java ParseException错误代码在发送到本机层时丢失

我一直在用parse测试处理过期会话,并试图捕获错误并将其发送到react本机层,但我遇到了问题,代码返回为“EUNSPECIFIED”,而不是“200”,这在iOS上没有发生。我的解决方案是下面用于处理错误的函数,但如果有人有更好的解决方案,请告诉我我知道


共 (1) 个答案

  1. # 1 楼答案

    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);
    }