From 6137aa0f734114d8efe1327c7281192f0ca82737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=8BAndrzej=20Ressel?= Date: Mon, 25 Nov 2024 12:33:52 +0100 Subject: [PATCH] Fix "ZIO.fail(throw" (#3220) --- zio-http/shared/src/main/scala/zio/http/ZClient.scala | 2 +- .../src/main/scala/zio/http/codec/HttpContentCodec.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zio-http/shared/src/main/scala/zio/http/ZClient.scala b/zio-http/shared/src/main/scala/zio/http/ZClient.scala index 1b8aa6431b..014d77cca6 100644 --- a/zio-http/shared/src/main/scala/zio/http/ZClient.scala +++ b/zio-http/shared/src/main/scala/zio/http/ZClient.scala @@ -670,7 +670,7 @@ object ZClient extends ZClientPlatformSpecific { webSocketUrl <- url.scheme match { case Some(Scheme.HTTP) | Some(Scheme.WS) | None => ZIO.succeed(url.scheme(Scheme.WS)) case Some(Scheme.WSS) | Some(Scheme.HTTPS) => ZIO.succeed(url.scheme(Scheme.WSS)) - case _ => ZIO.fail(throw new IllegalArgumentException("URL's scheme MUST be WS(S) or HTTP(S)")) + case _ => ZIO.fail(new IllegalArgumentException("URL's scheme MUST be WS(S) or HTTP(S)")) } scope <- ZIO.scope res <- requestAsync( diff --git a/zio-http/shared/src/main/scala/zio/http/codec/HttpContentCodec.scala b/zio-http/shared/src/main/scala/zio/http/codec/HttpContentCodec.scala index 3f8a3f29a2..916742b9e9 100644 --- a/zio-http/shared/src/main/scala/zio/http/codec/HttpContentCodec.scala +++ b/zio-http/shared/src/main/scala/zio/http/codec/HttpContentCodec.scala @@ -35,7 +35,7 @@ sealed trait HttpContentCodec[A] { self => ZIO.fromEither(codec.codec(config).decode(bytes)) } case None => - ZIO.fail(throw new IllegalArgumentException(s"No codec found for content type $contentType")) + ZIO.fail(new IllegalArgumentException(s"No codec found for content type $contentType")) } } @@ -50,7 +50,7 @@ sealed trait HttpContentCodec[A] { self => ZIO.fromEither(codec.codec(config).decode(bytes)) } case None => - ZIO.fail(throw new IllegalArgumentException(s"No codec found for content type $contentType")) + ZIO.fail(new IllegalArgumentException(s"No codec found for content type $contentType")) } }