getkyo / kyo

Toolkit for Scala Development
https://getkyo.io
Apache License 2.0
527 stars 44 forks source link

provide trace origin for fiber interruptions #463

Closed fwbrasil closed 3 months ago

fwbrasil commented 3 months ago

Fixes #448

Kyo currently doesn't show any information regarding the origin of fiber interrupts. For example, when a timeout happens we can only see that the fiber got interrupted. This PR addresses this limitation by storing the origin Trace in Fibers.Interrupted and adding it to the error message.

fwbrasil commented 3 months ago

There's an issue with the interruption integration with sttp. It can't inspect if the completion is an interruption anymore with this change: https://github.com/getkyo/kyo/blob/e8c68604dfcdc03fe0c82ad6f4b1f2e3b12f5a53/kyo-sttp/shared/src/main/scala/kyo/internal/KyoSttpMonad.scala#L58

I can't see a good solution for it so I'll close this for now and work on a change to avoid T < IOs as the completion value of fibers. It was a quick hack to avoid allocations for fiber completions but we can use a proper union type instead.