-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docs-rewrite << upstream update
- Loading branch information
Showing
9 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
zio-http/src/main/scala/zio/http/netty/client/ClientFailureHandler.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package zio.http.netty.client | ||
|
||
import zio.{Promise, Trace, Unsafe} | ||
|
||
import zio.http.Response | ||
import zio.http.netty.NettyRuntime | ||
|
||
import io.netty.channel.{ChannelHandlerContext, ChannelInboundHandlerAdapter} | ||
|
||
/** Handles failures happening in ClientInboundHandler */ | ||
final class ClientFailureHandler( | ||
rtm: NettyRuntime, | ||
onResponse: Promise[Throwable, Response], | ||
onComplete: Promise[Throwable, ChannelState], | ||
)(implicit trace: Trace) | ||
extends ChannelInboundHandlerAdapter { | ||
implicit private val unsafeClass: Unsafe = Unsafe.unsafe | ||
|
||
override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable): Unit = { | ||
rtm.runUninterruptible(ctx, NettyRuntime.noopEnsuring)( | ||
onResponse.fail(cause) *> onComplete.fail(cause), | ||
)(unsafeClass, trace) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters