From 1e263f2ba7992a7a8604fa32aa35de4c3da24df3 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Sat, 31 Jul 2010 00:44:51 -0700 Subject: [PATCH] Vector unhandled CLR exceptions from the runloop into Perl 6 exceptions --- Kernel.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Kernel.cs b/Kernel.cs index e412ff3b..9cd84ddf 100644 --- a/Kernel.cs +++ b/Kernel.cs @@ -660,7 +660,13 @@ public class Kernel { Frame root_f = new Frame(null, null, boot); Frame current = root_f; while (current != null) { - current = current.Continue(); + try { + current = current.Continue(); + } catch (Exception ex) { + ExceptionPacket ep = new FatalException( + new CLRImportObject(ex)); + current = ep.SearchForHandler(current); + } } } @@ -747,7 +753,9 @@ public abstract class ExceptionPacket { } } - throw new Exception("--- Unhandled exception in Perl 6 code ---"); + Console.Error.WriteLine("--- Unhandled exception in Perl 6 code ---"); + Environment.Exit(1); + return null; // TODO: backtrace, .Str } }