From 3158b64146148a74e84e8a56a33c6215fda963f2 Mon Sep 17 00:00:00 2001 From: "Yukihiro Okada (Yuki)" Date: Fri, 8 Sep 2023 01:07:32 +0900 Subject: [PATCH] http-codegen (fix): Improve the error messages for unknown client types (#3198) --- .../airframe/http/codegen/HttpCodeGenerator.scala | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/airframe-http-codegen/src/main/scala/wvlet/airframe/http/codegen/HttpCodeGenerator.scala b/airframe-http-codegen/src/main/scala/wvlet/airframe/http/codegen/HttpCodeGenerator.scala index 1e5bb3186d..494fe92cdf 100644 --- a/airframe-http-codegen/src/main/scala/wvlet/airframe/http/codegen/HttpCodeGenerator.scala +++ b/airframe-http-codegen/src/main/scala/wvlet/airframe/http/codegen/HttpCodeGenerator.scala @@ -72,7 +72,18 @@ object HttpClientGeneratorConfig { HttpClientGeneratorConfig( apiPackageName = packageName, clientType = HttpClientGenerator.findClient(tpe).getOrElse { - throw new IllegalArgumentException(s"Unknown client type: ${tpe}") + tpe match { + case "scalajs" => + throw new IllegalArgumentException( + s"Unknown client type: ${tpe}. scalajs is obsoleted. Use rpc instead}" + ) + case _ => + throw new IllegalArgumentException( + s"Unknown client type: ${tpe}. Supported client types: ${HttpClientGenerator.predefinedClients + .map(_.name).mkString(", ")}" + ) + } + }, targetPackageName = targetPackage, targetClassName = targetCls