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;
}
===============================================
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;
}
===============================================