[nem-en] Incorrect exception catching?

Snaury snaury at gmail.com
Fri Jun 30 09:54:25 CEST 2006


I already compared.

in C#:

.try {
}
.catch TargetInvocationException {
}
.catch Exception {
}

in Nemerle:

.try {
  .try {
  }
  .catch TargetInvocationException {
  }
}
.catch Exception {
}

On 6/30/06, Kamil Skalski <kamil.skalski at gmail.com> wrote:
> We should compare the IL, but it is most probably a bug.
>
> 2006/6/30, Snaury <snaury at gmail.com>:
> > I was just blocked by some non-C# behaviour in Nemerle (0.9.3), if I
> > try to catch multiple exception, each case is wrapped in its own try
> > block, which makes the following code work correctly in C#, but
> > incorrectly in Nemerle:
> >
> > // TARGET: test.exe
> > using System;
> > using System.Reflection;
> >
> > public module Program
> > {
> >   public Main() : void
> >   {
> >     try {
> >       throw TargetInvocationException("generated exception",
> > Exception("this is my inner exception"));
> >     } catch {
> >       | e is TargetInvocationException => throw Exception("unable to
> > do it", e.InnerException);
> >       | e is Exception => throw Exception("unable to do it", e);
> >     }
> >   }
> > }
> >
> > C#:
> >
> > Unhandled Exception: System.Exception: unable to do it --->
> > System.Exception: this is my inner exception
> >    --- End of inner exception stack trace ---
> >    at Program.Main()
> >
> > Nemerle:
> >
> > Unhandled Exception: System.Exception: unable to do it --->
> > System.Exception: unable to do it ---> System.Exception: this is my
> > inner exception
> >    --- End of inner exception stack trace ---
> >    at Program.Main()
> >    --- End of inner exception stack trace ---
> >    at Program.Main()
> >
> > I know that in this particular case I can do
> >
> >   | e => match(e) {
> >     | _ is TargetInvocationException => ...
> >     | _ is Exception => ...
> >   }
> >
> > to overcome it. But still I wonder if Nemerle's behaviour is designed
> > to be like this, or if it is a bug?
> >
> > _______________________________________________
> > https://nemerle.org/mailman/listinfo/devel-en
> >
>
>
> --
> Kamil Skalski
> http://nazgul.omega.pl
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>



More information about the devel-en mailing list