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

Improve exception transparency: explicitly allow throwing exceptions … #3017

Merged
merged 7 commits into from Nov 16, 2021

Commits on Nov 11, 2021

  1. Improve exception transparency: explicitly allow throwing exceptions …

    …from the upstream when the downstream has been failed, but also suppress such exceptions by the downstream one
    
    It solves the problem of graceful shutdown: when the upstream fails unwillingly (e.g. file.close() has thrown in 'finally') block, we cannot treat is as an exception transparency violation (hint: 'finally' is a shortcut for 'catch'+body), but we also cannot leave things as is, otherwise it leads to unforeseen consequences such as successful 'retry' and 'catch' operators that may, or may not, then fail with exception on attempt to emit.
    
    Downstream exception supersedes the upstream exception only if it is not an instance of CancellationException, semantically emulating cancellation-friendly 'use' block.
    
    Fixes #2860
    qwwdfsad committed Nov 11, 2021
    Copy the full SHA
    b3eade1 View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2021

  1. Update kotlinx-coroutines-core/common/src/flow/Flow.kt

    Co-authored-by: dkhalanskyjb <52952525+dkhalanskyjb@users.noreply.github.com>
    qwwdfsad and dkhalanskyjb committed Nov 12, 2021
    Copy the full SHA
    08a3ed3 View commit details
    Browse the repository at this point in the history
  2. Change the exception suppression invariant to work backwards:

    All the benefits of the approach stay the same, but additionally, for an arbitrary flow pipeline, adding a catch operator that is not triggered will no longer change the type of resulting exception
    qwwdfsad committed Nov 12, 2021
    Copy the full SHA
    9227f94 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2021

  1. Copy the full SHA
    c1ec29b View commit details
    Browse the repository at this point in the history
  2. ~remove excessive indent

    qwwdfsad committed Nov 16, 2021
    Copy the full SHA
    0731fa3 View commit details
    Browse the repository at this point in the history
  3. ~more tests

    qwwdfsad committed Nov 16, 2021
    Copy the full SHA
    8a85b5e View commit details
    Browse the repository at this point in the history
  4. ~improve KDoc

    qwwdfsad committed Nov 16, 2021
    Copy the full SHA
    90722b6 View commit details
    Browse the repository at this point in the history