我在一个类里catch里throw e 了一个错误,我怎么才可以在调用这个类的地方捕获这个异常呢?
谢谢

解决方案 »

  1.   

    说的捕获这个异常什么意思?
    throw Exception????
      

  2.   

    不明白啥意思,是捕获自定义的错误?
    自定义一个exception类,然后捕获抛出的这个错误类捕获某一个方法里面的小错误?
    在调用这个方法时用try catch
      

  3.   

    protected void button1_click(object sender,EventArgs e)
    {
       try
       {
            aaa();
       }
       catch(Exception e)
       {
            Response.write(e.Message);
       }
    }private void aaa()
    {
       throw new Exception("这个异常是从aaa里抛出的.")
    }
      

  4.   

    try
    {
        Callyourmethod();//maybe throw exception
    }
    catch(Excepion ex)
    {
        //if Callyourmethod() throw Exception,you can catch at here
        do something here;
    }