Yes, it seems like this would also work, but TBH it seems a little roundabout 
to me. Is the objective to avoid duplicates of the error string?

Maybe we could just extract the exception construction into a method:
```java
if (streamsGraphNode == null) {
  throw getNonWindowedGraceSearchException(chain);
}
...
public TopologyException getNonWindowedGraceSearchException(final String chain) 
{
  return new TopologyException(
    "Window close time is only defined for windowed computations. Got [" + 
chain + "]."
  );
}
```

Then again, I have doubts about whether adding an extra method to de-duplicate 
the (to me) simple logic of creating the exception is worth it at all. 
Especially considering that there's no particular reason that the exception 
message needs to be exactly the same in these two cases.

What say you?

[ Full content available at: https://github.com/apache/kafka/pull/5567 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to