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

Unified Diff: sdk/lib/_internal/pub/lib/src/log.dart

Issue 391363004: Include file path in JSON error when possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. 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: sdk/lib/_internal/pub/lib/src/log.dart
diff --git a/sdk/lib/_internal/pub/lib/src/log.dart b/sdk/lib/_internal/pub/lib/src/log.dart
index 0c2b1267bff779fca9cefabe6c1c1a91e8b9ee8b..6821581033d95c23e2838f1c385acf8cea37dfe3 100644
--- a/sdk/lib/_internal/pub/lib/src/log.dart
+++ b/sdk/lib/_internal/pub/lib/src/log.dart
@@ -506,6 +506,15 @@ class _JsonLogger {
errorJson["stackTrace"] = new Chain.forTrace(stackTrace).toString();
}
+ // If the error came from a file, include the path.
+ if (error is SpanException && error.span.sourceUrl != null) {
+ errorJson["path"] = p.fromUri(error.span.sourceUrl);
+ }
+
+ if (error is FileException) {
+ errorJson["path"] = error.path;
+ }
+
this.message(errorJson);
}

Powered by Google App Engine
This is Rietveld 408576698