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

Side by Side Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 434533002: Make any exception in the operations loop fatal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 try { 396 try {
397 operation.perform(this); 397 operation.perform(this);
398 } catch (exception, stackTrace) { 398 } catch (exception, stackTrace) {
399 AnalysisEngine.instance.logger.logError("${exception}\n${stackTrace}"); 399 AnalysisEngine.instance.logger.logError("${exception}\n${stackTrace}");
400 if (rethrowExceptions) { 400 if (rethrowExceptions) {
401 throw new AnalysisException( 401 throw new AnalysisException(
402 'Unexpected exception during analysis', 402 'Unexpected exception during analysis',
403 new CaughtException(exception, stackTrace)); 403 new CaughtException(exception, stackTrace));
404 } 404 }
405 _sendServerErrorNotification(exception, stackTrace); 405 _sendServerErrorNotification(exception, stackTrace);
406 shutdown();
406 } finally { 407 } finally {
407 if (!operationQueue.isEmpty) { 408 if (!operationQueue.isEmpty) {
408 _schedulePerformOperation(); 409 _schedulePerformOperation();
409 } else { 410 } else {
410 sendStatusNotification(null); 411 sendStatusNotification(null);
411 } 412 }
412 } 413 }
413 } 414 }
414 415
415 /** 416 /**
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 734 }
734 735
735 /** 736 /**
736 * Schedules [performOperation] exection. 737 * Schedules [performOperation] exection.
737 */ 738 */
738 void _schedulePerformOperation() { 739 void _schedulePerformOperation() {
739 new Future(performOperation); 740 new Future(performOperation);
740 } 741 }
741 742
742 /** 743 /**
743 * Sends a non-fatal `server.error` notification. 744 * Sends a fatal `server.error` notification.
744 */ 745 */
745 void _sendServerErrorNotification(exception, stackTrace) { 746 void _sendServerErrorNotification(exception, stackTrace) {
746 // prepare exception.toString() 747 // prepare exception.toString()
747 String exceptionString; 748 String exceptionString;
748 if (exception != null) { 749 if (exception != null) {
749 exceptionString = exception.toString(); 750 exceptionString = exception.toString();
750 } else { 751 } else {
751 exceptionString = 'null exception'; 752 exceptionString = 'null exception';
752 } 753 }
753 // prepare stackTrace.toString() 754 // prepare stackTrace.toString()
754 String stackTraceString; 755 String stackTraceString;
755 if (stackTrace != null) { 756 if (stackTrace != null) {
756 stackTraceString = stackTrace.toString(); 757 stackTraceString = stackTrace.toString();
757 } else { 758 } else {
758 stackTraceString = 'null stackTrace'; 759 stackTraceString = 'null stackTrace';
759 } 760 }
760 // send the notification 761 // send the notification
761 Notification notification = new Notification(SERVER_ERROR); 762 Notification notification = new Notification(SERVER_ERROR);
762 notification.setParameter(FATAL, false); 763 notification.setParameter(FATAL, true);
763 notification.setParameter(MESSAGE, exceptionString); 764 notification.setParameter(MESSAGE, exceptionString);
764 notification.setParameter(STACK_TRACE, stackTraceString); 765 notification.setParameter(STACK_TRACE, stackTraceString);
765 channel.sendNotification(notification); 766 channel.sendNotification(notification);
766 } 767 }
767 } 768 }
768 769
769 770
770 /** 771 /**
771 * An enumeration of the services provided by the analysis domain. 772 * An enumeration of the services provided by the analysis domain.
772 */ 773 */
(...skipping 17 matching lines...) Expand all
790 /** 791 /**
791 * An enumeration of the services provided by the server domain. 792 * An enumeration of the services provided by the server domain.
792 */ 793 */
793 class ServerService extends Enum2<ServerService> { 794 class ServerService extends Enum2<ServerService> {
794 static const ServerService STATUS = const ServerService('STATUS', 0); 795 static const ServerService STATUS = const ServerService('STATUS', 0);
795 796
796 static const List<ServerService> VALUES = const [STATUS]; 797 static const List<ServerService> VALUES = const [STATUS];
797 798
798 const ServerService(String name, int ordinal) : super(name, ordinal); 799 const ServerService(String name, int ordinal) : super(name, ordinal);
799 } 800 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698