Skip to content

Choose instance for nacos #2006

@cnzbq

Description

@cnzbq

code:

...
     try {
         instance = namingService.selectOneHealthyInstance(name, Collections.singletonList(clusterName));
     } catch (NacosException e) {
                log.warn("not find same clusterName instance ", e);
     }
...

When clusterName instance not exist, thorws java.lang.IllegalStateException, catch NacosException is invalid.

version:

  • springcloud Greenwich.SR2
  • Spring Cloud Alibaba 2.1.0.RELEASE

在获取指定集群名称的实例时,我对NacosException进行了捕获,但是当集群中没有我要获取的微服务时,会抛出IllegalStateException,而非NacosException。但是明确要求用户捕获的是NacosException,不知道这样是不是对开发者体验有些不太友好

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions