-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
1 - XS (<= 1 day)
-
8115
How frequently does the bug occur?
Always
Description
I'm trying to handle network errors, i.e. any random error that will be solved by just trying again later, to redirect the user to the proper support page.
In Swift there are a good number of error codes dedicated to those:
case kCFURLErrorUnknown = -998 case kCFURLErrorCancelled = -999 case kCFURLErrorTimedOut = -1001 case kCFURLErrorCannotFindHost = -1003 case kCFURLErrorCannotConnectToHost = -1004 case kCFURLErrorNetworkConnectionLost = -1005 case kCFURLErrorDNSLookupFailed = -1006 case kCFURLErrorNotConnectedToInternet = -1009 case kCFURLErrorInternationalRoamingOff = -1018 case kCFURLErrorDataNotAllowed = -1020 case kCFURLErrorSecureConnectionFailed = -1200
But errors thrown from Realm do not match those codes. After trying to sign in a user for instance, I get an error like this:
(error as NSError).code // = -1 (error as NSError).domain // = io.realm.app (error as NSError).userInfo // = ["NSLocalizedDescription": The request timed out., "HTTP Status Code": 0]
Another non-Realm process running at the same time returned the following error:
[-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
The errors thrown from Realm should have matching error codes, otherwise we can't properly handle them.
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
- Enable Network Link Conditioner on your iOS device, set to 100% Loss
- Try to sign in a user or do whatever with Realm
Version
10.32.3
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
Are you using encryption?
No
Platform OS and version(s)
iOS 16.0.3
Build environment
Xcode version: 14.1
Installed using SPM