ableegoldman commented on a change in pull request #11123: URL: https://github.com/apache/kafka/pull/11123#discussion_r675938982
########## File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java ########## @@ -386,23 +405,23 @@ public void setStateListener(final KafkaStreams.StateListener listener) { * terminates due to an uncaught exception. * * @param uncaughtExceptionHandler the uncaught exception handler for all internal threads; {@code null} deletes the current handler - * @throws IllegalStateException if this {@code KafkaStreams} instance is not in state {@link State#CREATED CREATED}. + * @throws IllegalStateException if this {@code KafkaStreams} instance has already been started. * * @deprecated Since 2.8.0. Use {@link KafkaStreams#setUncaughtExceptionHandler(StreamsUncaughtExceptionHandler)} instead. * */ @Deprecated public void setUncaughtExceptionHandler(final Thread.UncaughtExceptionHandler uncaughtExceptionHandler) { synchronized (stateLock) { - if (state == State.CREATED) { + if (state.hasNotStarted()) { oldHandler = true; processStreamThread(thread -> thread.setUncaughtExceptionHandler(uncaughtExceptionHandler)); if (globalStreamThread != null) { globalStreamThread.setUncaughtExceptionHandler(uncaughtExceptionHandler); } } else { - throw new IllegalStateException("Can only set UncaughtExceptionHandler in CREATED state. " + + throw new IllegalStateException("Can only set UncaughtExceptionHandler before calling start(). " + Review comment: I feel we've had a number of users be confused by this error message before, because they don't know what it actually means for the state to be `CREATED` -- a more useful exception would be to describe what they did wrong/need to do right to fix this -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org