zoukankan      html  css  js  c++  java
  • 切莫忘记try catch

    interFaceMessagePost msg = (interFaceMessagePost)list[i];
                        string url =msg.UrlPost +"?"+msg.UrlParameter;
                        URL=url;
                        ForderFormId=msg.ForderformID;

                        //新的编码之后的url
                        string _tempExpesion="";
                        //发出票成功消息
                        Regex ticket=new Regex("tickets=(.*)");
                        bool isHaveTicket=ticket.Match(url).Success;
                        if(isHaveTicket)
                        {
                            if(ticket.Match(url).Groups!=null && ticket.Match(url).Groups.Count>0)
                            {
                                _tempExpesion=ticket.Match(url).Groups[1].Value;
                                url=url.Replace(_tempExpesion,System.Web.HttpUtility.UrlEncode(_tempExpesion));
                            }
                        }
                        else
                        {

                            Regex refundDetail=new Regex("RefundDeatils=(.*)");
                            bool isHaveRefund=refundDetail.Match(url).Success;
                            if(isHaveRefund)
                            {
                                if(refundDetail.Match(url).Groups!=null && refundDetail.Match(url).Groups.Count>0)
                                {
                                    _tempExpesion=refundDetail.Match(url).Groups[1].Value;
                                    url=url.Replace(_tempExpesion,System.Web.HttpUtility.UrlEncode(_tempExpesion));
                                }
                            }
                        }

    没有加try catch导致出错之后程序卡死

  • 相关阅读:
    GitLab CI/CD的官译【原】
    Gearman介绍、原理分析、实践改进
    Golang逃逸分析
    Go 程序是怎样跑起来的
    分布式系统的常见玩法
    开发更高可用、高质量的服务的一些建议
    理解 Kubernetes 的亲和性调度
    服务发现对比:Zookeeper vs etcd vs Consul
    探索etcd,Zookeeper和Consul一致键值数据存储的性能
    CentOS 7 安装无线驱动
  • 原文地址:https://www.cnblogs.com/bangejingting/p/2595289.html
Copyright © 2011-2022 走看看