Chrisaldi Posted February 9, 2004 Posted February 9, 2004 I want to catch any soapexception error by these method. My question is Does creating an instance from assembly name can retrieve exception errors from UI? I have read documents on handling soapexception errors but i want to make it general on this. Is this procedure posible? Because it returns an error message of "HRESULT has returned from a call to a COM Component." I hope you could help me on this. Any idea would be a great help! Thanks! Chris. =============================================== catch(Exception err) { throw (Exception)CreateObjectInstance(err); } private object CreateObjectInstance(Exception err) { Object obj; Assembly[] assemblyArray; string str = err.Message.Substring(err.Message.IndexOf("---> ") + 5, err.Message.IndexOf(" (") - err.Message.IndexOf("---> ") - 5); assemblyArray = new Assembly[AppDomain.CurrentDomain.GetAssemblies().Length]; assemblyArray = AppDomain.CurrentDomain.GetAssemblies(); foreach(Assembly assembly in assemblyArray) { Type[] mytypes = assembly.GetTypes(); foreach(Type t in mytypes) { if(t.FullName == str) { obj = Activator.CreateInstance(t) return obj; } } } return null; } =============================================== Quote
Moderators Robby Posted February 9, 2004 Moderators Posted February 9, 2004 try this... try { //''code goes here. } Catch COMException ce { Context.Trace.Write (ce, "COMException caught.") ; switch (ce.ErrorCode ) case &H80070005 : throw new SecurityException("something", ce) ; //''Additional statement go here. break; } } Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.