簡體   English   中英

發送到本機層時ParseException錯誤代碼丟失

[英]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);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM