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

Unified Diff: runtime/lib/convert_patch.dart

Issue 389603002: Add extra information to FormatException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: runtime/lib/convert_patch.dart
diff --git a/runtime/lib/convert_patch.dart b/runtime/lib/convert_patch.dart
index 25346bd1ef8ff7603bbf04981ed3b0feaf1b3e22..fa684a4dd2c8eabdcf361fe972ac5e0b5814247a 100644
--- a/runtime/lib/convert_patch.dart
+++ b/runtime/lib/convert_patch.dart
@@ -33,8 +33,6 @@ abstract class _JsonListener {
void beginArray() {}
void arrayElement() {}
void endArray() {}
- /** Called on failure to parse [source]. */
- void fail(String source, int position, String message) {}
}
/**
@@ -568,16 +566,7 @@ class _JsonParser {
void fail(int position, [String message]) {
if (message == null) message = "Unexpected character";
- listener.fail(source, position, message);
- // If the listener didn't throw, do it here.
- String slice;
- int sliceEnd = position + 20;
- if (sliceEnd > source.length) {
- slice = "'${source.substring(position)}'";
- } else {
- slice = "'${source.substring(position, sliceEnd)}...'";
- }
- throw new FormatException("Unexpected character at $position: $slice");
+ throw new FormatException(message, source, position);
}
}

Powered by Google App Engine
This is Rietveld 408576698