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

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

Issue 1480663002: Remove duplicated stack trace from error notifications (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/analysis_logger.dart ('k') | pkg/analyzer/lib/src/generated/java_engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 2b58ebfb40d0523e6da6ee00932821a843b750ac..6a5ace1f3ee8e8b5febf0bcd558c579adbf97ae9 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -892,35 +892,28 @@ class AnalysisServer {
/**
* Sends a `server.error` notification.
*/
- void sendServerErrorNotification(String msg, exception, stackTrace,
+ void sendServerErrorNotification(String message, exception, stackTrace,
{bool fatal: false}) {
- // prepare exception.toString()
- String exceptionString;
+ StringBuffer buffer = new StringBuffer();
if (exception != null) {
- exceptionString = exception.toString();
+ buffer.write(exception);
} else {
- exceptionString = 'null exception';
+ buffer.write('null exception');
}
- // prepare message
- String message = msg != null ? '$msg\n$exceptionString' : exceptionString;
- // prepare stackTrace.toString()
- String stackTraceString;
if (stackTrace != null) {
- stackTraceString = stackTrace.toString();
- } else {
+ buffer.writeln();
+ buffer.write(stackTrace);
+ } else if (exception is! CaughtException) {
try {
throw 'ignored';
} catch (ignored, stackTrace) {
- stackTraceString = stackTrace.toString();
- }
- if (stackTraceString == null) {
- // This code should be unreachable.
- stackTraceString = 'null stackTrace';
+ buffer.writeln();
+ buffer.write(stackTrace);
}
}
// send the notification
channel.sendNotification(
- new ServerErrorParams(fatal, message, stackTraceString)
+ new ServerErrorParams(fatal, message, buffer.toString())
.toNotification());
}
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_logger.dart ('k') | pkg/analyzer/lib/src/generated/java_engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698