Exemplo n.º 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.
            //

            JsException exception;

            if (error.Exception.Type == JsValueType.String)
            {
                exception = new JsException(type, resource, message, line, column, null);
            }
            else if (type == "SyntaxError")
            {
                exception = new JsSyntaxError(type, resource, message, line, column);
            }
            else
            {
                JsObject nativeException = (JsObject)convert.FromJsValue(error.Exception);
                exception = new JsException(type, resource, message, line, column, nativeException);
            }
            return(exception);
        }
Exemplo n.º 2
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;
        }