Fix Firebase fetch() KDoc to document CancellationException#154
Fix Firebase fetch() KDoc to document CancellationException#154kirich1409 wants to merge 1 commit intomainfrom
Conversation
The catch block was updated to rethrow CancellationException (instead of RuntimeException) in a prior commit, but the KDoc still described the old behavior. Update the @throws documentation to reflect the actual semantics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review Summary by QodoDocument CancellationException behavior in Firebase fetch() KDoc
WalkthroughsDescription• Update KDoc to document CancellationException propagation behavior • Clarify that FetchException wraps all non-cancellation exceptions • Document that RuntimeException from await() is wrapped in FetchException • Specify that CancellationException is propagated without wrapping Diagramflowchart LR
A["fetch() method"] --> B["Firebase operation"]
B --> C{"Exception type?"}
C -->|"CancellationException"| D["Propagate directly"]
C -->|"Other exceptions"| E["Wrap in FetchException"]
D --> F["Updated KDoc"]
E --> F
File Changes1. providers/firebase/src/main/kotlin/dev/androidbroadcast/featured/firebase/FirebaseConfigValueProvider.kt
|
Code Review by Qodo
|
There was a problem hiding this comment.
Pull request overview
Updates Firebase provider documentation to match the current fetch() exception semantics (propagating coroutine cancellation while wrapping other failures in FetchException).
Changes:
- Refines
FirebaseConfigValueProvider.fetch()KDoc to explicitly documentCancellationExceptionpropagation. - Clarifies that other non-cancellation failures are wrapped in
FetchExceptionand preserved ascause.
| * @throws FetchException if the Firebase fetch operation fails for any reason, including | ||
| * network errors, timeouts, or service unavailability. This wraps all non-cancellation | ||
| * exceptions — including [RuntimeException] thrown by [kotlinx.coroutines.tasks.await] | ||
| * on Firebase task failure. The [FetchException.cause] holds the original exception for | ||
| * diagnostics. See [FetchException] for retry recommendations. |
There was a problem hiding this comment.
KDoc says the fetch operation fails "for any reason" but the implementation only wraps non-cancellation Exceptions (and will still let non-Exception Throwables like Error propagate). Consider tightening the wording to match the actual behavior: wraps all non-cancellation exceptions thrown by await() / Firebase APIs.
| * @throws FetchException if the Firebase fetch operation fails for any reason, including | |
| * network errors, timeouts, or service unavailability. This wraps all non-cancellation | |
| * exceptions — including [RuntimeException] thrown by [kotlinx.coroutines.tasks.await] | |
| * on Firebase task failure. The [FetchException.cause] holds the original exception for | |
| * diagnostics. See [FetchException] for retry recommendations. | |
| * @throws FetchException if [kotlinx.coroutines.tasks.await] or the underlying Firebase | |
| * Remote Config APIs throw a non-cancellation [Exception] while fetching, including | |
| * errors such as network failures, timeouts, or service unavailability. The | |
| * [FetchException.cause] holds the original exception for diagnostics. See | |
| * [FetchException] for retry recommendations. |
| * exceptions — including [RuntimeException] thrown by [kotlinx.coroutines.tasks.await] | ||
| * on Firebase task failure. The [FetchException.cause] holds the original exception for | ||
| * diagnostics. See [FetchException] for retry recommendations. | ||
| * @throws kotlinx.coroutines.CancellationException if the coroutine is cancelled while |
There was a problem hiding this comment.
For consistency with the rest of the file (e.g., @throws IllegalStateException above) and to avoid redundancy with the existing import, consider using CancellationException instead of the fully-qualified kotlinx.coroutines.CancellationException in the @throws tag.
| * @throws kotlinx.coroutines.CancellationException if the coroutine is cancelled while | |
| * @throws CancellationException if the coroutine is cancelled while |
Summary
FirebaseConfigValueProvider.fetch()to accurately describe exception behaviorCancellationExceptionis propagated without wrappingRuntimeException) are wrapped inFetchExceptionThe catch block was already fixed in a prior commit to rethrow
CancellationExceptioninstead ofRuntimeException, but the KDoc was not updated to reflect the new semantics.Test plan
🤖 Generated with Claude Code