Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: base/json/json_parser.cc

Issue 1571633002: Pass Manifest JSON paser error line and column number to console. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/json/json_parser.h" 5 #include "base/json/json_parser.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 JSONReader::JsonParseError JSONParser::error_code() const { 269 JSONReader::JsonParseError JSONParser::error_code() const {
270 return error_code_; 270 return error_code_;
271 } 271 }
272 272
273 std::string JSONParser::GetErrorMessage() const { 273 std::string JSONParser::GetErrorMessage() const {
274 return FormatErrorMessage(error_line_, error_column_, 274 return FormatErrorMessage(error_line_, error_column_,
275 JSONReader::ErrorCodeToString(error_code_)); 275 JSONReader::ErrorCodeToString(error_code_));
276 } 276 }
277 277
278 int JSONParser::error_line() const {
279 return error_line_;
280 }
281
282 int JSONParser::error_column() const {
283 return error_column_;
284 }
285
278 // StringBuilder /////////////////////////////////////////////////////////////// 286 // StringBuilder ///////////////////////////////////////////////////////////////
279 287
280 JSONParser::StringBuilder::StringBuilder() 288 JSONParser::StringBuilder::StringBuilder()
281 : pos_(NULL), 289 : pos_(NULL),
282 length_(0), 290 length_(0),
283 string_(NULL) { 291 string_(NULL) {
284 } 292 }
285 293
286 JSONParser::StringBuilder::StringBuilder(const char* pos) 294 JSONParser::StringBuilder::StringBuilder(const char* pos)
287 : pos_(pos), 295 : pos_(pos),
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 const std::string& description) { 974 const std::string& description) {
967 if (line || column) { 975 if (line || column) {
968 return StringPrintf("Line: %i, column: %i, %s", 976 return StringPrintf("Line: %i, column: %i, %s",
969 line, column, description.c_str()); 977 line, column, description.c_str());
970 } 978 }
971 return description; 979 return description;
972 } 980 }
973 981
974 } // namespace internal 982 } // namespace internal
975 } // namespace base 983 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698