Skip to content

Commit

Permalink
add error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bli committed Nov 28, 2023
1 parent 11542c2 commit 370475e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ private[snowpark] object ErrorMessage {
"0420" -> "Invalid RSA private key. The error is: %s",
"0421" -> "Invalid stage location: %s. Reason: %s.",
"0422" -> "Internal error: Server fetching is disabled for the parameter %s and there is no default value for it.",
"0423" -> "Invalid input argument, Session.tableFunction only supports table function arguments")
"0423" -> "Invalid input argument, Session.tableFunction only supports table function arguments",
"0424" ->
"""Invalid input argument type, the input argument type of Explode function should be either Map or Array types.
|The input argument type: %s
|""".stripMargin)
// scalastyle:on

/*
Expand Down Expand Up @@ -393,6 +397,9 @@ private[snowpark] object ErrorMessage {
def MISC_INVALID_TABLE_FUNCTION_INPUT(): SnowparkClientException =
createException("0423")

def MISC_INVALID_EXPLODE_ARGUMENT_TYPE(argumentType: String): SnowparkClientException =
createException("0424", argumentType)

/**
* Create Snowpark client Exception.
*
Expand Down
11 changes: 11 additions & 0 deletions src/test/scala/com/snowflake/snowpark/ErrorMessageSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -830,4 +830,15 @@ class ErrorMessageSuite extends FunSuite {
ex.message.startsWith("Error Code: 0423, Error message: Invalid input argument, " +
"Session.tableFunction only supports table function arguments"))
}

test("MISC_INVALID_EXPLODE_ARGUMENT_TYPE") {
val ex = ErrorMessage.MISC_INVALID_EXPLODE_ARGUMENT_TYPE(types.IntegerType.typeName)
assert(ex.telemetryMessage.equals(ErrorMessage.getMessage("0424")))
assert(
ex.message.startsWith(
"Error Code: 0424, Error message: " +
"Invalid input argument type, the input argument type of " +
"Explode function should be either Map or Array types.\n" +
"The input argument type: Integer"))
}
}

0 comments on commit 370475e

Please sign in to comment.