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

Side by Side 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 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core' hide Resource; 9 import 'dart:core' hide Resource;
10 import 'dart:math' show max; 10 import 'dart:math' show max;
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 /** 885 /**
886 * Send the given [response] to the client. 886 * Send the given [response] to the client.
887 */ 887 */
888 void sendResponse(Response response) { 888 void sendResponse(Response response) {
889 channel.sendResponse(response); 889 channel.sendResponse(response);
890 } 890 }
891 891
892 /** 892 /**
893 * Sends a `server.error` notification. 893 * Sends a `server.error` notification.
894 */ 894 */
895 void sendServerErrorNotification(String msg, exception, stackTrace, 895 void sendServerErrorNotification(String message, exception, stackTrace,
896 {bool fatal: false}) { 896 {bool fatal: false}) {
897 // prepare exception.toString() 897 StringBuffer buffer = new StringBuffer();
898 String exceptionString;
899 if (exception != null) { 898 if (exception != null) {
900 exceptionString = exception.toString(); 899 buffer.write(exception);
901 } else { 900 } else {
902 exceptionString = 'null exception'; 901 buffer.write('null exception');
903 } 902 }
904 // prepare message
905 String message = msg != null ? '$msg\n$exceptionString' : exceptionString;
906 // prepare stackTrace.toString()
907 String stackTraceString;
908 if (stackTrace != null) { 903 if (stackTrace != null) {
909 stackTraceString = stackTrace.toString(); 904 buffer.writeln();
910 } else { 905 buffer.write(stackTrace);
906 } else if (exception is! CaughtException) {
911 try { 907 try {
912 throw 'ignored'; 908 throw 'ignored';
913 } catch (ignored, stackTrace) { 909 } catch (ignored, stackTrace) {
914 stackTraceString = stackTrace.toString(); 910 buffer.writeln();
915 } 911 buffer.write(stackTrace);
916 if (stackTraceString == null) {
917 // This code should be unreachable.
918 stackTraceString = 'null stackTrace';
919 } 912 }
920 } 913 }
921 // send the notification 914 // send the notification
922 channel.sendNotification( 915 channel.sendNotification(
923 new ServerErrorParams(fatal, message, stackTraceString) 916 new ServerErrorParams(fatal, message, buffer.toString())
924 .toNotification()); 917 .toNotification());
925 } 918 }
926 919
927 /** 920 /**
928 * Send status notification to the client. The `operation` is the operation 921 * Send status notification to the client. The `operation` is the operation
929 * being performed or `null` if analysis is complete. 922 * being performed or `null` if analysis is complete.
930 */ 923 */
931 void sendStatusNotification(ServerOperation operation) { 924 void sendStatusNotification(ServerOperation operation) {
932 // Only send status when subscribed. 925 // Only send status when subscribed.
933 if (!serverServices.contains(ServerService.STATUS)) { 926 if (!serverServices.contains(ServerService.STATUS)) {
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 /** 1667 /**
1675 * The [PerformanceTag] for time spent in server request handlers. 1668 * The [PerformanceTag] for time spent in server request handlers.
1676 */ 1669 */
1677 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1670 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1678 1671
1679 /** 1672 /**
1680 * The [PerformanceTag] for time spent in split store microtasks. 1673 * The [PerformanceTag] for time spent in split store microtasks.
1681 */ 1674 */
1682 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1675 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1683 } 1676 }
OLDNEW
« 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