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

Unified Diff: pkg/analysis_server/lib/src/status/ast_writer.dart

Issue 899513003: Improve error reporting on status page (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/status/ast_writer.dart
diff --git a/pkg/analysis_server/lib/src/status/ast_writer.dart b/pkg/analysis_server/lib/src/status/ast_writer.dart
index a5dd302da2b3c06d3077d7b558c8e45ced275f6a..97e9fa4eae46d824029ea9024b5260c9b54ee97a 100644
--- a/pkg/analysis_server/lib/src/status/ast_writer.dart
+++ b/pkg/analysis_server/lib/src/status/ast_writer.dart
@@ -7,6 +7,7 @@ library analysis_server.src.status.ast_writer;
import 'dart:convert';
import 'package:analyzer/src/generated/ast.dart';
+import 'package:analyzer/src/generated/java_engine.dart';
/**
* A visitor that will produce an HTML representation of an AST structure.
@@ -23,6 +24,12 @@ class AstWriter extends UnifyingAstVisitor {
int indentLevel = 0;
/**
+ * A list containing the exceptions that were caught while attempting to write
+ * out an AST structure.
+ */
+ List<CaughtException> exceptions = <CaughtException>[];
+
+ /**
* Initialize a newly created element writer to write the HTML representation
* of visited nodes on the given [buffer].
*/
@@ -174,9 +181,21 @@ class AstWriter extends UnifyingAstVisitor {
*/
void _writeProperty(String name, Object value) {
if (value != null) {
+ String valueString = null;
+ try {
+ valueString = value.toString();
+ } catch (exception, stackTrace) {
+ exceptions.add(new CaughtException(exception, stackTrace));
+ }
_indent(2);
buffer.write('$name = ');
- buffer.write(HTML_ESCAPE.convert(value.toString()));
+ if (valueString == null) {
+ buffer.write('<span style="color: #FF0000">');
+ buffer.write(HTML_ESCAPE.convert(value.runtimeType.toString()));
Paul Berry 2015/02/02 23:08:59 Nit: this will print "Null" in red whenever an err
Brian Wilkerson 2015/02/02 23:25:03 Why? The value of 'value' is known to be non-null,
Paul Berry 2015/02/02 23:32:27 Sorry, I misread the code. lgtm as is.
+ buffer.write('</span>');
+ } else {
+ buffer.write(HTML_ESCAPE.convert(valueString));
+ }
buffer.write('<br>');
}
}
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698