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

Unable to parse the exact error from ParseError #439

Open
4 tasks done
kennic opened this issue Mar 7, 2023 · 1 comment · May be fixed by #438
Open
4 tasks done

Unable to parse the exact error from ParseError #439

kennic opened this issue Mar 7, 2023 · 1 comment · May be fixed by #438

Comments

@kennic
Copy link

kennic commented Mar 7, 2023

New Issue Checklist

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}"
@parse-github-assistant
Copy link

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.

@kennic kennic linked a pull request Mar 7, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant