Пример #1
0
        internal static JsException Create(JsConvert convert, JsError error)
        {
            string   type            = (string)convert.FromJsValue(error.Type);
            string   resource        = (string)convert.FromJsValue(error.Resource);
            string   message         = (string)convert.FromJsValue(error.Message);
            int      line            = error.Line;
            int      column          = error.Column + 1; // because zero based.
            JsObject nativeException = (JsObject)convert.FromJsValue(error.Exception);

            JsException exception;

            if (type == "SyntaxError")
            {
                exception = new JsSyntaxError(type, resource, message, line, column);
            }
            else
            {
                exception = new JsException(type, resource, message, line, column, nativeException);
            }
            return(exception);
        }
Пример #2
0
        internal static JsException Create(JsConvert convert, IntPtr nativeErrorObject)
        {
            unsafe
            {
                JsError *jsErr           = (JsError *)nativeErrorObject;
                string   type            = (string)convert.FromJsValuePtr((JsValue *)jsErr->type);
                string   res             = (string)convert.FromJsValuePtr((JsValue *)jsErr->resource);
                string   msg             = (string)convert.FromJsValuePtr((JsValue *)jsErr->message);
                JsObject nativeException = (JsObject)convert.FromJsValuePtr((JsValue *)jsErr->exception);

                JsException exception;
                if (type == "SyntaxError")
                {
                    //from syntax error?
                    exception = new JsSyntaxError(type, res, msg, jsErr->line, jsErr->column);
                }
                else
                {
                    exception = new JsException(type, res, msg, jsErr->line, jsErr->column, nativeException);
                }
                return(exception);
            }
        }
Пример #3
0
        internal static JsException Create(JsConvert convert, JsError error)
        {
            string type = (string)convert.FromJsValue(error.Type);
            string resource = (string)convert.FromJsValue(error.Resource);
            string message = (string)convert.FromJsValue(error.Message);
            int line = error.Line;
            int column = error.Column + 1; // because zero based.
            JsObject nativeException = (JsObject)convert.FromJsValue(error.Exception);

            JsException exception;
            if (type == "SyntaxError")
            {
                exception = new JsSyntaxError(type, resource, message, line, column);
            }
            else
            {
                exception = new JsException(type, resource, message, line, column, nativeException);
            }
            return exception;
        }