异常

异常提示

BMR异常提示有如下两种方式:

异常方法 说明
BceClientException 客户端异常
BceServerException 服务器异常

获取事件异常

用户可以使用try获取某个事件所产生的异常,例如:

try {
    CreateClusterResponse response = bmrClient.createCluster(
            new CreateClusterRequest().withName("java-sdk-test")
                                      .withImageType("hadoop")
                                      .withImageVersion("0.1.0")
                                      .withAutoTerminate(false)
                                      .withLogUri("bos://tester01/sdk/")
                                      .withInstanceGroups(instanceGroups)
                                      .withApplications(applications)
    );
} catch (BceServiceException e) {
    System.out.println(e.getMessage());
} catch (BceClientException e) {
    System.out.println(e.getMessage());
}