Copilot commented on code in PR #5784:
URL: https://github.com/apache/texera/pull/5784#discussion_r3440711283


##########
amber/src/main/scala/org/apache/texera/amber/engine/architecture/scheduling/RegionExecutionCoordinator.scala:
##########
@@ -572,10 +572,18 @@ class RegionExecutionCoordinator(
         val portBaseURI = portConfig.storageURIBase
         val resultURI = VFSURIFactory.resultURI(portBaseURI)
         val stateURI = VFSURIFactory.stateURI(portBaseURI)
-        val schemaOptional =
-          
region.getOperator(outputPortId.opId).outputPorts(outputPortId.portId)._3
         val schema =
-          schemaOptional.getOrElse(throw new IllegalStateException("Schema is 
missing"))
+          
region.getOperator(outputPortId.opId).outputPorts(outputPortId.portId)._3 match 
{
+            case Right(resolvedSchema) => resolvedSchema
+            case Left(cause)           =>
+              // The output port schema failed to resolve (e.g. a dataset the 
workflow reads is not
+              // shared with the running user, making its file and inferred 
schema unavailable).
+              // Surface the underlying cause instead of a generic "Schema is 
missing" (issue #3546).
+              throw new IllegalStateException(
+                s"Failed to resolve the output schema: ${cause.getMessage}",
+                cause
+              )
+          }

Review Comment:
   `cause.getMessage` can be null for some Throwables, which would produce an 
unhelpful error message ("...: null"). It’s also useful to include the failing 
`outputPortId` so users can identify which output port/schema failed when there 
are multiple outputs.



-- 
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]

Reply via email to