[nem-en] Incorrect exception catching?
Kamil Skalski
kamil.skalski at gmail.com
Fri Jun 30 09:51:29 CEST 2006
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
More information about the devel-en
mailing list