Skip to content

Unable to parse the exact error from ParseError #439

Open
@kennic

Description

@kennic

New Issue Checklist

  • I am not disclosing a vulnerability.
    I am not just asking a question.
    I have searched through existing issues.
    I can reproduce the issue with the latest versions of Parse Server and the Parse Swift SDK.

Issue Description

The current SDK returns all errors with ParseError which can not be used to determine the exact error details to show on the UI.

Steps to reproduce

  • Disconnect the internet on your device (Turn on Airplane Mode)
  • Try to call any CloudCode function

Actual Outcome

You will get this ParseError:

(lldb) po error
ParseError code=-1 error=Unable to connect with parse-server: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282733570 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://host/functions/FunctionName, NSErrorFailingURLKey=https://host/functions/FunctionName, _kCFStreamErrorDomainKey=1}
  - code : ParseSwift.ParseError.Code.unknownError
  - message : "Unable to connect with parse-server: Error Domain=NSURLErrorDomain Code=-1009 \"The Internet connection appears to be offline.\" UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282733570 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 \"(null)\" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>, _NSURLErrorRelatedURLSessionTaskErrorKey=(\n    \"LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>\"\n), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://host/functions/FunctionName, NSErrorFailingURLKey=https://host/functions/FunctionName, _kCFStreamErrorDomainKey=1}"
  - otherCode : nil

You'll get these details:

(lldb) po error.domain
"ParseSwift.ParseError"

(lldb) po error.code
1

(lldb) po error.localizedDescription
"ParseError code=-1 error=Unable to connect with parse-server: Error Domain=NSURLErrorDomain Code=-1009 \"The Internet connection appears to be offline.\" UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282733570 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 \"(null)\" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>, _NSURLErrorRelatedURLSessionTaskErrorKey=(\n    \"LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>\"\n), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey= host/functions/FunctionName, NSErrorFailingURLKey=https://host/functions/FunctionName, _kCFStreamErrorDomainKey=1}"

We can not get the exact error domain NSURLErrorDomain, code -1009 with the message The Internet connection appears to be offline to display it on the UI correctly, but only ParseSwift.ParseError code 1 all the time.

Expected Outcome

We need an originalError variable in ParseError so we can check what was the exact error that caused the problem, not just ParseSwift.ParseError code 1

Environment

Client

  • Parse Swift SDK version: 4.14.2
  • Xcode version: 14.2
  • Operating system (iOS, macOS, watchOS, etc.): iOS 16.3
  • Operating system version: MacOS

Server

  • Parse Server version: 4.5.0
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): AWS

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 3.6
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): AWS

Logs

(lldb) po error
ParseError code=-1 error=Unable to connect with parse-server: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282733570 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://host/functions/FunctionName, NSErrorFailingURLKey=https://host/functions/FunctionName, _kCFStreamErrorDomainKey=1}
  - code : ParseSwift.ParseError.Code.unknownError
  - message : "Unable to connect with parse-server: Error Domain=NSURLErrorDomain Code=-1009 \"The Internet connection appears to be offline.\" UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282733570 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 \"(null)\" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>, _NSURLErrorRelatedURLSessionTaskErrorKey=(\n    \"LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>\"\n), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://host/functions/FunctionName, NSErrorFailingURLKey=https://host/functions/FunctionName, _kCFStreamErrorDomainKey=1}"
  - otherCode : nil

(lldb) po error.domain
"ParseSwift.ParseError"

(lldb) po error.code
1

(lldb) po error.localizedDescription
"ParseError code=-1 error=Unable to connect with parse-server: Error Domain=NSURLErrorDomain Code=-1009 \"The Internet connection appears to be offline.\" UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282733570 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 \"(null)\" UserInfo={_NSURLErrorNWPathKey=unsatisfied (No network route), _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>, _NSURLErrorRelatedURLSessionTaskErrorKey=(\n    \"LocalDataTask <27703A59-4B71-4320-B775-0560BC43DFDB>.<6>\"\n), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey= host/functions/FunctionName, NSErrorFailingURLKey=https://host/functions/FunctionName, _kCFStreamErrorDomainKey=1}"

Activity

parse-github-assistant

parse-github-assistant commented on Mar 7, 2023

@parse-github-assistant

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
linked a pull request that will close this issue on Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @kennic

      Issue actions

        Unable to parse the exact error from ParseError · Issue #439 · parse-community/Parse-Swift