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

Unlink saving crash stacktrace from Sentry #4895

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

jpelgrom
Copy link
Member

Summary

A couple of years ago I added saving uncaught fatal exceptions to the app to display them to the user, using a hook provided by Sentry. Turns out it is not too difficult to do it without Sentry, so this PR changes that.

It will still pass exceptions on to Sentry if initialized (tested). Saving the crash is always on now because it no longer involves Sentry/a 3rd party you might want to switch off.

(Maybe it will also catch more stuff now that it is simpler, because I feel like recently it hasn't worked very well.)

Screenshots

I did code an exception to test but actually got a real crash :)

Light Dark
App log screen with 'recent crash' tab selected and a crash stacktrace, light mode App log screen with 'recent crash' tab selected and a crash stacktrace, dark mode
Crash text (note that I switched timestamp/thread after taking the screenshot)
Timestamp: 2024-12-10 19:04:54.070
Thread: main
Exception: java.lang.IllegalStateException: Testing
	at io.homeassistant.companion.android.settings.SettingsFragment.onCreatePreferences$lambda$46$lambda$45(SettingsFragment.kt:355)
	at io.homeassistant.companion.android.settings.SettingsFragment.$r8$lambda$0g-zfgYjQ-VCcAfvQ5UjEk4dvso(Unknown Source:0)
	at io.homeassistant.companion.android.settings.SettingsFragment$$ExternalSyntheticLambda1.onPreferenceClick(D8$$SyntheticClass:0)
	at androidx.preference.Preference.performClick(Preference.java:1200)
	at androidx.preference.Preference.performClick(Preference.java:1182)
	at androidx.preference.Preference$1.onClick(Preference.java:182)
	at android.view.View.performClick(View.java:8033)
	at android.view.View.performClickInternal(View.java:8010)
	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
	at android.view.View$PerformClick.run(View.java:31336)
	at android.os.Handler.handleCallback(Handler.java:991)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loopOnce(Looper.java:232)
	at android.os.Looper.loop(Looper.java:317)
	at android.app.ActivityThread.main(ActivityThread.java:8787)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871)

Link to pull request in Documentation repository

n/a

Any other notes

Copy link
Member

@dshokouhi dshokouhi left a comment

Choose a reason for hiding this comment

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

Awesome! Hope we start seeing this work better too!

@dshokouhi dshokouhi enabled auto-merge (squash) December 10, 2024 18:34
@dshokouhi dshokouhi merged commit af6bc04 into home-assistant:master Dec 10, 2024
4 checks passed
@jpelgrom jpelgrom deleted the crash-save-without-sentry branch December 10, 2024 18:40
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