trycatch 只包含容易出异常的地方

   private void addOnce(
            Shop shop) {
       
        try {
              ChainStoreAddRequest request = new ChainStoreAddRequest();

        ChainStoreAddInfo chainStoreAddInfo = new ChainStoreAddInfo();
        chainStoreAddInfo.setName(shop.getShopName());
        chainStoreAddInfo.setContactPhone(shop.getPhoneNum());
        chainStoreAddInfo.setAddress(shop.getAddress());
        chainStoreAddInfo.setLongitude(shop.getLongitude().toString());
        chainStoreAddInfo.setLatitude(shop.getLatitude().toString());

        request.setChainStore(chainStoreAddInfo);
            ChainStoreAddResponse response = client.execute(request);

            System.out.println(response.getData());
        } catch (Exception e) {
            System.out.println(e);
        }
    }




 private void addOnce(
            Shop shop) {
        ChainStoreAddRequest request = new ChainStoreAddRequest();

        ChainStoreAddInfo chainStoreAddInfo = new ChainStoreAddInfo();
        chainStoreAddInfo.setName(shop.getShopName());
        chainStoreAddInfo.setContactPhone(shop.getPhoneNum());
        chainStoreAddInfo.setAddress(shop.getAddress());
        chainStoreAddInfo.setLongitude(shop.getLongitude().toString());
        chainStoreAddInfo.setLatitude(shop.getLatitude().toString());

        request.setChainStore(chainStoreAddInfo);

        try {
            ChainStoreAddResponse response = client.execute(request);

            System.out.println(response.getData());
        } catch (Exception e) {
            System.out.println(e);
        }
    }

 

posted @ 2018-01-19 15:11  小虾米丶  阅读(111)  评论(0编辑  收藏  举报