public override string FormatException(Exception exception)
    {
      while (exception is TargetInvocationException)
      {
        exception = exception.InnerException;
      }
      Builtins.lastException = exception;

      if (exception is Builtins.Continuation)
      {
        // cheat
        return @"&implementation-restriction
&message:             continuations cannot be used in this way, sorry :(";
      }

      if (exception is ThreadAbortException)
      {
        return "evaluation aborted";
      }

      if (exception is SchemeException)
      {
        return exception.ToString();
      }

      var w = new IronScheme.Runtime.StringWriter();
      w.WriteLine("Unhandled CLR exception reading input:");
      "(display {0} {1})".Eval(exception, w);
      return w.GetBuffer();
    }
        public override string FormatException(Exception exception)
        {
            while (exception is TargetInvocationException)
            {
                exception = exception.InnerException;
            }
            Builtins.lastException = exception;

            if (exception is Builtins.Continuation)
            {
                // cheat
                return(@"&implementation-restriction
&message:             continuations cannot be used in this way, sorry :(");
            }

            if (exception is ThreadAbortException)
            {
                return("evaluation aborted");
            }

            if (exception is SchemeException)
            {
                return(exception.ToString());
            }

            var w = new IronScheme.Runtime.StringWriter();

            w.WriteLine("Unhandled CLR exception reading input:");
            "(display {0} {1})".Eval(exception, w);
            return(w.GetBuffer());
        }
Пример #3
0
        public override string FormatException(Exception exception)
        {
            while (exception is TargetInvocationException)
            {
                exception = exception.InnerException;
            }
            Builtins.lastException = exception;

            if (exception is Builtins.Continuation)
            {
                // cheat
                return(@"&implementation-restriction
&message: ""continuations cannot be used in this way, sorry :(""");
            }

            if (exception is ThreadAbortException)
            {
                return("evaluation aborted");
            }

            if (exception is SchemeException)
            {
                return(exception.ToString());
            }

            if (exception is SyntaxErrorException)
            {
                var parts = exception.Message.Split('|');
                if (parts.Length > 1)
                {
                    return(@"Unhandled exception while reading input:
&lexical
&message: """ + parts[0] + @"""
&irritants: (""" + parts[1] + @""")
");
                }
                else
                {
                    return(@"Unhandled exception while reading input:
&lexical
&message: """ + parts[0] + @"""
");
                }
            }

            var w = new IronScheme.Runtime.StringWriter();

            w.WriteLine("Unhandled CLR exception reading input:");
            "(display {0} {1})".Eval(exception, w);
            return(w.GetBuffer());
        }
Пример #4
0
        public override string FormatException(Exception exception)
        {
            while (exception is TargetInvocationException)
              {
            exception = exception.InnerException;
              }
              Builtins.lastException = exception;

              if (exception is Builtins.Continuation)
              {
            // cheat
            return @"&implementation-restriction
            &message: ""continuations cannot be used in this way, sorry :(""";
              }

              if (exception is ThreadAbortException)
              {
            return "evaluation aborted";
              }

              if (exception is SchemeException)
              {
            return exception.ToString();
              }

              if (exception is SyntaxErrorException)
              {
            var parts = exception.Message.Split('|');
            if (parts.Length > 1)
            {
              return @"Unhandled exception while reading input:
            &lexical
            &message: """ + parts[0] + @"""
            &irritants: (""" + parts[1] + @""")
            ";
            }
            else
            {
              return @"Unhandled exception while reading input:
            &lexical
            &message: """ + parts[0] + @"""
            ";
            }
              }

              var w = new IronScheme.Runtime.StringWriter();
              w.WriteLine("Unhandled CLR exception reading input:");
              "(display {0} {1})".Eval(exception, w);
              return w.GetBuffer();
        }