Skip to content

Commit 255cb6f

Browse files
committed
Add descriptive error when orchestration type is not registered
Replace NullPointerException with IllegalStateException containing a descriptive message when a worker receives an orchestration event for a type it doesn't have registered. This helps users understand that workers that don't support the requested orchestration type are connected to the task hub.
1 parent 8bb8050 commit 255cb6f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/src/main/java/com/microsoft/durabletask/TaskOrchestrationExecutor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,13 @@ private void processEvent(HistoryEvent e) {
882882
// Try getting the default orchestrator
883883
factory = TaskOrchestrationExecutor.this.orchestrationFactories.get("*");
884884
}
885-
// TODO: Throw if the factory is null (orchestration by that name doesn't exist)
885+
if (factory == null) {
886+
throw new IllegalStateException(
887+
"No orchestration factory registered for orchestration type '" + name + "'. " +
888+
"This usually means that a worker that doesn't support this orchestration type " +
889+
"is connected to this task hub. Make sure the worker has a registered " +
890+
"orchestration for '" + name + "'.");
891+
}
886892
TaskOrchestration orchestrator = factory.create();
887893
orchestrator.run(this);
888894
break;

0 commit comments

Comments
 (0)