public static NotControllerException newWrongControllerException(OptionalInt controllerId) {
        if (controllerId.isPresent()) {
            return new NotControllerException("The active controller appears to be node " +
                    controllerId.getAsInt() + ".");
        } else {
            return new NotControllerException("No controller appears to be active.");
        }
    }
Create a new exception indicating that current node is not the controller.

@param controllerId      The current controller.
@return                  The new NotControllerException.
metadata/src/main/java/org/apache/kafka/controller/errors/ControllerExceptions.java