[Mono-list] Using Exceptions with external Plugins
Pablo Fischer
pablo@pablo.com.mx
Mon, 28 Jun 2004 20:14:21 -0500
--=-cJyNDXYmcrpOHONEhahD
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable
Cool! Thanks!
Now, how can I get sure that the InnerException is a
XmlRpcFaultException or a XmlRpcMissedSomething?, I'm trying with this:
} catch(TargetInvocationException e) {
if(e.InnerException.GetType().ToString() =3D=3D =20
"CookComputing.XmlRpc.XmlRpcFaultException") {
Console.WriteLine("yes");
}
But I don't think it's the correct way/code, any suggestions?
Thanks!
Pablo
El lun, 28-06-2004 a las 18:54, Arild Fines escribi=F3:
> mono-list-admin@lists.ximian.com wrote:
> > Hi!
> >
> > I'm loading many plugins (assemblies, dll) from my App.exe, however
> > sometimes a plugin can throw an exception, how can I catch it?, I can
> > only catch the System.Reflection.TargetInvocationException cause I'm
> > using Reflection/Invoke techniques.. but I can't 'catch' 'internal
> > Exceptions' of these plugins.
> >
> > For example, a Plugin.dll can throw a
> > CookComputing.XmlRpc.XmlRpcFaultException and it doesn't works, however
> > System.Reflection.TargetInvocationException seems to catch it, but just
> > the Invoke Exception.
> >
> > Any ideas?
> > Pablo
>=20
> The docs on TargetInvocationException has this:
>=20
> "When created, the TargetInvocationException is passed a reference to the
> exception thrown by the method invoked through reflection. The
> InnerException property holds the underlying exception."
>=20
> So tex.InnerException should give you what you need.
>=20
> --
> Arild
>=20
> AnkhSVN: http://ankhsvn.tigris.org
> Blog: http://ankhsvn.com/blog
> IRC: irc://irc.freenode.net/ankhsvn
>=20
> "Weaseling out of things is good. It's what separates us from the other
> animals....except weasels." -- Homer Simpson
>=20
> _______________________________________________
> Mono-list maillist - Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
--=20
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Fingerprint: 5973 0F10 543F 54AE 1E41 EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx=20
http://www.debianmexico.org
--=-cJyNDXYmcrpOHONEhahD
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
digitalmente
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQBA4MJsCEChCnSk5cARAuXpAKCBtJcMmpFOEQWTq6ROY1oI7A6ptgCglxRb
dQLINxcNKVAuMig1XB73/LU=
=8XNp
-----END PGP SIGNATURE-----
--=-cJyNDXYmcrpOHONEhahD--