8000 Print interruptions in `ZIO#debug` by kyri-petrou · Pull Request #9473 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Print interruptions in ZIO#debug #9473

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

Merged
merged 3 commits into from
Jan 23, 2025

Conversation

kyri-petrou
Copy link
Contributor

Currently ZIO#debug doesn't print anything when the effect is interrupted, which can be annoying if using this method to debug issues

hearnadam
hearnadam previously approved these changes Jan 22, 2025
Comment on lines 460 to 461
case exit @ Exit.Success(value) => println(s"$prefix: $value"); exit
case exit @ Exit.Failure(error) => println(s"<FAIL> $prefix: $error"); exit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side effecting code without explicit suspension always makes my eyes bleed...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrapped the calls to println within ZIO.succeed. I also realised there was another debug method that had to be changed so I fixed that one as well

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I don't think it's strictly necessary since exitWith will actually suspend, but I think it's probably for the best.

@kyri-petrou kyri-petrou merged commit e96e786 into zio:series/2.x Jan 23, 2025
18 checks passed
@kyri-petrou kyri-petrou deleted the debug-interruption branch January 23, 2025 02:52
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
0