You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2023/08/16 02:55:52 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #42471: [SPARK-44785][SQL][CONNECT] Convert common alreadyExistsExceptions and noSuchExceptions

cloud-fan commented on code in PR #42471:
URL: https://github.com/apache/spark/pull/42471#discussion_r1295328538


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala:
##########
@@ -62,14 +63,20 @@ private[client] object GrpcExceptionConverter extends JsonUtils {
   }
 
   private def errorConstructor[T <: Throwable: ClassTag](
-      throwableCtr: (String, Throwable) => T): (String, (String, Throwable) => Throwable) = {
+      throwableCtr: (String, Option[Throwable]) => T)
+      : (String, (String, Option[Throwable]) => Throwable) = {
     val className = implicitly[reflect.ClassTag[T]].runtimeClass.getName
     (className, throwableCtr)
   }
 
   private val errorFactory = Map(
     errorConstructor((message, _) => new ParseException(None, message, Origin(), Origin())),
-    errorConstructor((message, cause) => new AnalysisException(message, cause = Option(cause))))
+    errorConstructor((message, cause) => new AnalysisException(message, cause = cause)),
+    errorConstructor((message, _) => new NamespaceAlreadyExistsException(message)),

Review Comment:
   is it to match spark sql?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org