FrankYang0529 commented on code in PR #69257:
URL: https://github.com/apache/airflow/pull/69257#discussion_r3518873165
##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/Client.kt:
##########
@@ -153,3 +153,25 @@ class Client internal constructor(
mapIndex = details.ti.mapIndex ?: -1,
)
}
+
+/**
+ * Thrown when a task parameter with a primitive type reads an XCom that was
never pushed.
+ */
+class MissingXComException(
+ message: String,
+) : IllegalStateException(message) {
+ companion object {
+ @JvmStatic
+ fun requireXCom(
+ value: Any?,
+ taskId: String,
+ paramName: String,
+ ): Any =
+ value
+ ?: throw MissingXComException(
+ "Task parameter '$paramName' requires an XCom from task '$taskId',
but none was pushed. " +
+ "This parameter has a primitive type that cannot be null; declare
it with a boxed type " +
+ "(e.g. Integer instead of int) to receive null.",
+ )
+ }
Review Comment:
I removed the static method and changed to use if to check null in
BuilderProcessor.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]