Ejemplo n.º 1
0
        /// <summary>Create a new exception with a given message, kind,
        /// and stack trace, and throw a wrapped version of it</summary>
        /// <param name="kind">Exception kind</param>
        /// <param name="message">Human-readable message for exception</param>
        public static void Throw(string kind, string message)
        {
            var gep  = new GraceExceptionPacket(kind, message);
            var gepe = new GraceExceptionPacketException(gep);

            throw gepe;
        }
Ejemplo n.º 2
0
        /// <summary>Create a new exception with a given message, kind,
        /// and stack trace, and throw a wrapped version of it</summary>
        /// <param name="kind">Exception kind</param>
        /// <param name="message">Human-readable message for exception</param>
        /// <param name="stackTrace">Human-readable stack trace</param>
        public static void Throw(GraceExceptionKind kind, string message,
                                 List <string> stackTrace)
        {
            var gep  = new GraceExceptionPacket(kind, message, stackTrace);
            var gepe = new GraceExceptionPacketException(gep);

            throw gepe;
        }
Ejemplo n.º 3
0
        private void start()
        {
            var apply = MethodRequest.Nullary("apply");

            try
            {
                block.Request(interpreter, apply);
            }
            catch (GraceExceptionPacketException gepe)
            {
                exception = gepe.ExceptionPacket;
                ErrorReporting.WriteException(exception);
            }
        }
Ejemplo n.º 4
0
        /// <summary>Native method for Grace raise</summary>
        /// <param name="ctx">Current interpreter</param>
        /// <param name="message">Message string</param>
        public GraceObject Raise(EvaluationContext ctx, GraceObject message)
        {
            var msg           = "<<No message>>";
            var asGraceString = message.Request(ctx,
                                                MethodRequest.Nullary("asString"))
                                .FindNativeParent <GraceString>();

            if (asGraceString != null)
            {
                msg = asGraceString.Value;
            }
            GraceExceptionPacket.Throw(this, msg, ctx.GetStackTrace());
            return(GraceObject.Done);
        }
Ejemplo n.º 5
0
 /// <param name="gep">Grace exception to be wrapped</param>
 public GraceExceptionPacketException(GraceExceptionPacket gep)
 {
     ExceptionPacket = gep;
 }