[IronPython] Code broken in RC2

Stanislas Pinte stan at ertmssolutions.com
Mon Aug 21 18:21:14 CEST 2006


by looking at IronPythonConsole sources, it seems it might be like:

private static void DefaultExceptionHandler(object sender,
UnhandledExceptionEventArgs args) {
            MyConsole.WriteLine("Unhandled exception: ", Style.Error);

MyConsole.Write(engine.FormatException((Exception)args.ExceptionObject),
Style.Error);
        }

Can anyone from the team confirm this?

Thanks a lot,

Stan.

Stanislas Pinte a écrit :
> Hello,
> 
> I was using the Console class to get a more or less clean dump of
> exceptions in my embedded scripting engine:
> 
> DummyConsole dummy = new DummyConsole();
> engine.MyConsole = dummy;
> engine.DumpException(nested);
> 
> This code is now broken in IronPython RC2...any suggestions on how to
> fix this?
> 
> Thanks a lot,
> 
> Stan.
> 
> internal class DummyConsole : IConsole
>   {
>     private StringBuilder stringBuilder = new StringBuilder();
> 
>     public string ReadLine(int autoIndentSize)
>     {
>       throw new NotImplementedException();
>     }
> 
>     public void Write(string text, Style style)
>     {
>       //Console.Out.Write(text, style);
>       stringBuilder.Append(text);
>     }
> 
>     public void WriteLine(string text, Style style)
>     {
>       //Console.Out.WriteLine(text, style);
>       stringBuilder.Append(text);
>       stringBuilder.AppendLine();
>     }
> 
>     internal string FlushBuffer()
>     {
>       string value = stringBuilder.ToString();
>       stringBuilder = new StringBuilder();
>       return value;
>     }
>   }
> 


-- 
-----------------------------------------------------------------
   Stanislas Pinte             e-mail: stan at ertmssolutions.com
   ERTMS Solutions               http://www.ertmssolutions.com
   Rue de l'Autonomie, 1             Tel:    + 322 - 522.06.63
   1070        Bruxelles              Fax:   + 322 - 522.09.30
-----------------------------------------------------------------
   Skype (http://www.skype.com) id:                  stanpinte
-----------------------------------------------------------------




More information about the Ironpython-users mailing list