Skip to content

Exception reporter disentangling for Android UI code #1345

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

Merged
merged 1 commit into from
Jun 17, 2025

Conversation

rjrjr
Copy link
Contributor

@rjrjr rjrjr commented Jun 13, 2025

Uses Throwable.withKey in a few more choke points, to break up crash reporter kitchen sinks. Had to make a few internal core methods public to allow their use from the android modules, but I think that's okay -- they're still in a package named internal, our intent should be clear.

@rjrjr rjrjr marked this pull request as ready for review June 17, 2025 16:08
@rjrjr rjrjr requested review from a team and zach-klippenstein as code owners June 17, 2025 16:08
@@ -3,6 +3,33 @@ package com.squareup.workflow1.internal
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract

/**
* Like Kotlin's [requireNotNull], but uses [stackTraceKey] to create a fake top element
* on the stack trace, ensuring that BugSnag's default grouping will create unique
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You could generalize this to "any crash reporter that uses stacktrace" rather than particular Bugsnag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, accidental copy paste from the internal method.

* @throws IllegalArgumentException if the [value] is false.
*/
@OptIn(ExperimentalContracts::class)
inline fun <T : Any> requireNotNullWithKey(
Copy link
Contributor

Choose a reason for hiding this comment

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

i think you'll have to mark this public for explicit API mode, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup. I wonder why the build didn't catch that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh, I wonder if we turned off that check for internal package. If so I think I can undo the other explicit publics I added in here. Trying it out…

@rjrjr rjrjr enabled auto-merge June 17, 2025 19:40
@rjrjr rjrjr force-pushed the ray/more-exception-detangling branch from 6ab9934 to 2e1add9 Compare June 17, 2025 19:55
Uses `Throwable.withKey` in a few more choke points, to break up crash reporter kitchen sinks. Had to make a few `internal` core methods public to allow their use from the android modules, but I think that's okay -- they're still in a package named `internal`, our intent should be clear.
@rjrjr rjrjr force-pushed the ray/more-exception-detangling branch from 2e1add9 to 0495048 Compare June 17, 2025 21:56
@rjrjr rjrjr merged commit c789f9b into main Jun 17, 2025
43 checks passed
@rjrjr rjrjr deleted the ray/more-exception-detangling branch June 17, 2025 22:20
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 this pull request may close these issues.

2 participants