[Mono-list] Using Exceptions with external Plugins
Iain McCoy
iain@mccoy.id.au
Tue, 29 Jun 2004 14:33:09 +1000
On Tue, 2004-06-29 at 11:14, Pablo Fischer wrote:
> 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() ==
> "CookComputing.XmlRpc.XmlRpcFaultException") {
> Console.WriteLine("yes");
else
> }
>
> But I don't think it's the correct way/code, any suggestions?
You might try this:
if(e.InnerException is CookComputing.XmlRpc.XmlRpcFaultException)
You should also do something sensible with exceptions that fail all your
if statements. That might be rethrowing or some sort of generic error
message.
--
Iain McCoy <iain@mccoy.id.au>