Skip to content

Guard against all uncaught exceptions in the serial executor block#997

Open
pmathew92 wants to merge 1 commit into
v4_developmentfrom
port/970-executor-guard
Open

Guard against all uncaught exceptions in the serial executor block#997
pmathew92 wants to merge 1 commit into
v4_developmentfrom
port/970-executor-guard

Conversation

@pmathew92

Copy link
Copy Markdown
Contributor

Summary

Ports the serial-executor exception guard (#970) onto the v4_development branch as its own feature.

  • Adds runCatchingOnExecutor helper to BaseCredentialsManager, wrapping each serialExecutor.execute { } body in a catch (Throwable) -> onFailure(UNKNOWN_ERROR) safety net so unexpected errors surface as a failure callback instead of being swallowed on the executor thread.
  • Wraps all 3 CredentialsManager and all 3 SecureCredentialsManager execute blocks; removes the now-redundant trailing catch (RuntimeException) blocks while keeping the domain-specific catches (AuthenticationException, CredentialsManagerException, IncompatibleDeviceException, CryptoException).
  • Brings SecureCredentialsManager.continueGetApiCredentials to parity with the other two blocks by mapping a save failure to STORE_FAILED (rather than letting it fall through to the new UNKNOWN_ERROR net).

This is the v4 port of the change merged to main in #970; reconciled onto v4's restructured credentials managers and test imports (org.mockito.kotlin.*).

Test plan

  • ./gradlew :auth0:compileDebugKotlin
  • ./gradlew :auth0:testDebugUnitTest — full suite green
  • 5 new tests in CredentialsManagerTest (98 total), 4 new in SecureCredentialsManagerTest (131 total), 0 failures
  • Verified wrap/catch parity against fix : Guard against all uncaught exception in the serial executor block #970 (3+3 execute blocks wrapped, STORE_FAILED 3=3, domain catches match)

@pmathew92 pmathew92 requested a review from a team as a code owner June 30, 2026 16:40
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e63994ad-b70f-412a-8065-d62fbebfa0e0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch port/970-executor-guard

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

tokenType.orEmpty(),
refreshToken,
Date(expiresAt),
storedScope
val expiresAt = fresh.expiresAt.time
val willAccessTokenExpire = willExpire(expiresAt, minTtl.toLong())
if (willAccessTokenExpire) {
val tokenLifetime = (expiresAt - currentTimeInMillis - minTtl * 1000) / -1000
val expiresAt = newCredentials.expiresAt.time
val willAccessTokenExpire = willExpire(expiresAt, minTtl.toLong())
if (willAccessTokenExpire) {
val tokenLifetime = (expiresAt - currentTimeInMillis - minTtl * 1000) / -1000
val expiresAt = fresh.expiresAt.time
val willAccessTokenExpire = willExpire(expiresAt, minTtl.toLong())
if (willAccessTokenExpire) {
val tokenLifetime = (expiresAt - currentTimeInMillis - minTtl * 1000) / -1000
val expiresAt = newCredentials.expiresAt.time
val willAccessTokenExpire = willExpire(expiresAt, minTtl.toLong())
if (willAccessTokenExpire) {
val tokenLifetime = (expiresAt - currentTimeInMillis - minTtl * 1000) / -1000
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