zoukankan      html  css  js  c++  java
  • 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);
            }
        }
  • 相关阅读:
    shell脚本day06-sed
    shell脚本day05-交互式输入与for语句
    shell脚本day04-if语句
    shell脚本day04-grep与正则表达式
    shell脚本day03-编程原理
    shell脚本day02-重定向与管道符
    编程原理大致介绍
    进程管理
    Linux网络
    shell脚本--grep以及正则表达式
  • 原文地址:https://www.cnblogs.com/loserchange/p/8317059.html
Copyright © 2011-2022 走看看