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

Call error callback for ZIO die failures #1979

Merged
merged 2 commits into from
Feb 8, 2023
Merged

Call error callback for ZIO die failures #1979

merged 2 commits into from
Feb 8, 2023

Conversation

vigoo
Copy link
Contributor

@vigoo vigoo commented Feb 7, 2023

Resolves #1973

@codecov-commenter
Copy link

Codecov Report

Base: 64.30% // Head: 64.31% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (36faf00) compared to base (fe43dc5).
Patch coverage: 100.00% of modified lines in pull request are covered.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1979      +/-   ##
==========================================
+ Coverage   64.30%   64.31%   +0.01%     
==========================================
  Files         193      193              
  Lines        5922     5924       +2     
  Branches      217      221       +4     
==========================================
+ Hits         3808     3810       +2     
  Misses       2114     2114              
Impacted Files Coverage Δ
...a/zio/http/netty/server/ServerInboundHandler.scala 86.11% <100.00%> (+0.26%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

.fold[UIO[Response]](
response => ZIO.succeedNow(response),
cause =>
(cause.dieOption match {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the error callback should be a function Cause[Nothing] => ZIO[Any, Nothing, Any]?

This is also pushing a little on whether the exit should really be ZIO[Any, Nothing, Response].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe. I think probably it's original goal was only to report netty exceptions, but I think the linked user request to also call it with ZIO die failures from handlers is reasonable. But I did not think of changing the callback type itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to Cause[Nothing]

@jdegoes jdegoes merged commit 79413b9 into main Feb 8, 2023
@jdegoes jdegoes deleted the issue-1973 branch February 8, 2023 09:46
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.

Server doesn't call errorCallback
4 participants