[Oztechan/CCC#4796] Make TerminationException extend CancellationException#4797
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ +0.00% coverage variation |
| Diff coverage | ✅ 100.00% diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (49b365d) 3341 1746 52.26% Head commit (378b410) 3341 (+0) 1746 (+0) 52.26% (+0.00%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#4797) 1 1 100.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull request overview
This PR adjusts the project’s cancellation error wrapper so that coroutine cancellations remain true cancellations under structured concurrency. By making TerminationException a CancellationException, parent jobs should treat the child as cancelled (not failed), avoiding “Parent job is Cancelling” failure noise while preserving the library→project error mapping.
Changes:
- Change
TerminationExceptionto extendkotlinx.coroutines.CancellationExceptioninstead ofThrowable. - Add a brief comment explaining the structured-concurrency rationale for the type change.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Maps coroutine cancellation into the project's error taxonomy. Extends CancellationException (not | ||
| // Throwable) so structured concurrency still recognises it as cancellation and unwinds cleanly. | ||
| internal class TerminationException(cause: Throwable) : CancellationException(cause.message) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4797 +/- ##
========================================
Coverage 55.29% 55.29%
========================================
Files 169 169
Lines 3033 3033
Branches 452 452
========================================
Hits 1677 1677
Misses 1331 1331
Partials 25 25
🚀 New features to boost your workflow:
|
|



BaseNetworkServicemaps library exceptions into the project error taxonomy, incl.is CancellationException -> TerminationException(e). ButTerminationExceptionextendedThrowable, so a cancelled coroutine threw a non-cancellation exception — breaking structured concurrency (parent treats the child as failed, not cancelled) and producingParent job is Cancellingstack-dump noise.Fix:
TerminationExceptionnow extendsCancellationException(via the commonCancellationException(message)constructor) instead ofThrowable. The library→project mapping is unchanged, so the abstraction is preserved — but the framework now recognises it as cancellation and unwinds cleanly.The existing
BaseNetworkServiceTest(assertFailsWith(TerminationException::class)) still holds — cancellation still maps toTerminationException.✅ Verified:
:common:core:network:jvmTestpasses. Mirrors Oztechan/AdTrack#57.Resolves #4796