Ejemplo n.º 1
0
        internal static JsonReaderException Create(IJsonLineInfo lineInfo, string path, string message, Exception ex)
        {
            message = JsonPosition.FormatMessage(lineInfo, path, message);

            int lineNumber;
            int linePosition;

            if (lineInfo != null && lineInfo.HasLineInfo())
            {
                lineNumber   = lineInfo.LineNumber;
                linePosition = lineInfo.LinePosition;
            }
            else
            {
                lineNumber   = 0;
                linePosition = 0;
            }

            return(new JsonReaderException(message, ex, path, lineNumber, linePosition));
        }
Ejemplo n.º 2
0
        private JsonContainerType Pop()
        {
            JsonPosition oldPosition;

            if (_stack != null && _stack.Count > 0)
            {
                oldPosition      = _currentPosition;
                _currentPosition = _stack[_stack.Count - 1];
                _stack.RemoveAt(_stack.Count - 1);
            }
            else
            {
                oldPosition      = _currentPosition;
                _currentPosition = new JsonPosition();
            }

            if (_maxDepth != null && Depth <= _maxDepth)
            {
                _hasExceededMaxDepth = false;
            }

            return(oldPosition.Type);
        }
Ejemplo n.º 3
0
        internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message)
        {
            message = JsonPosition.FormatMessage(lineInfo, path, message);

            return(new JsonException(message));
        }
Ejemplo n.º 4
0
        internal static JsonWriterException Create(string path, string message, Exception ex)
        {
            message = JsonPosition.FormatMessage(null, path, message);

            return(new JsonWriterException(message, ex, path));
        }