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

Improves the error logging in [TracksContextManager persistentStoreCoordinator]. #223

Conversation

diegoreymendez
Copy link
Contributor

@diegoreymendez diegoreymendez commented Sep 8, 2022

Improves the error logging in [TracksContextManager persistentStoreCoordinator] to try and detect possible issues with the URLs and prewarming.

This is because we're seeing failures in DO where the file cannot be created.

Testing:

  1. Make these two conditions always succeed by prepending them with true ||:

if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {

and

if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {

  1. Add the following line here:
error = [NSError errorWithDomain:"testing" code:1 userInfo:nil];
  1. Make sure you've set the Sentry's DSN in Settings.swift (there's a tracks demo android project) so you can run the demo App.

  2. Run the demo app

Make sure you see something like this in your log when it crashes:

Tracks <E>: Unresolved error Error Domain=asd Code=1 "(null)", {
}. Context info {prewarming=0, storeURL=file:///Users/kybos/Library/Developer/CoreSimulator/Devices/056C5AA2-93D7-459C-88FC-8922966C81F0/data/Containers/Data/Application/35DB0537-8EE3-47F1-9510-6F55529B3F84/Library/Application%20Support/com.automattic.TracksDemo/Tracks.sqlite}.

Copy link
Contributor

@bjhomer bjhomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@diegoreymendez diegoreymendez merged commit 79fc152 into trunk Sep 8, 2022
@diegoreymendez diegoreymendez deleted the diego/add-context-info-to-persistentStoreCoordinator-error branch September 8, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants