<form1.cs>
myclass mc = new myclass();
mc.ExecuteSystemObject("para");
라고 할 때
에러가 발생 시 
(1) form1.cs의 listbox1.Items.Add("async 에러출력" + errormsg);
(2) 또는 파일에 저장하고 싶은데 이것도 async로 할까요?
<myclass.cs>
public async System.Threading.Tasks.Task<JObject> ExecuteSystemObject(string parameters)
{    
    try 
    {
        dynamic j = await ExternalProject.ExecuteSomething<MyModel>(parameters);
        //How i can catch the error from the another class?
        ...
    }
    catch(Exception e)
    {
        //WebException will be caught here
    }
}
public async Task<Object> ExecuteSomething<T>() where T : IModel, new()
{
    try 
    {
        WebResponse response = await ExternalProject.ExecuteRequestAsync(PostRequest);
    }
    catch(Exception)
    {
        throw;
    }
}
public static async Task<WebResponse> ExecuteRequestAsync(WebRequest request)
{
    try
    {
        //return await request.GetResponseAsync();
        throw new WebException("Test error message");
    }
    catch(WebException e)
    {
        throw;
    }
}
        
        
                    
                    
                    
                    
                    
    
                    
                    
                    
                    
                    
                
                    [최초 등록일: ]
                    [최종 수정일: 4/4/2023]