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

Don't crash application if invoked too early #112

Closed
Cykelero opened this issue Jul 20, 2023 · 1 comment
Closed

Don't crash application if invoked too early #112

Cykelero opened this issue Jul 20, 2023 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Cykelero
Copy link

When the host application attempts to send a telemetry event, but hasn't yet initialized the TelemetryManager, the manager calls fatalError():

public static var shared: TelemetryManager {
    if let telemetryManager = initializedTelemetryManager {
    /* […] */
    } else {
        fatalError("Please call TelemetryManager.initialize(...) before accessing the shared telemetryManager instance.")
    }

}

As a result, if in a released app, a rarely occurring code path unexpectedly calls TelemetryManager.send() too early, the app will crash.
This is not good! A failure to send a telemetry event is not a fatal event, and the SDK should not make this crashing choice on the behalf of the host app. In my opinion, an assertionFailure call would be much more appropriate.

@winsmith winsmith added the help wanted Extra attention is needed label Oct 4, 2023
@winsmith winsmith added the bug Something isn't working label Oct 20, 2023
@Cykelero
Copy link
Author

Fixed by #146.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants