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

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

Issue 570453002: gracefully handle internal exceptions during request (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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/doc/api.html ('k') | pkg/analysis_server/lib/src/generated_protocol.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 d5944ba01154dbca78735eed012ebebd317f3400..c4ca2d2330a7d256fb6cd7d4dea42da5dee2875b 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -389,23 +389,32 @@ class AnalysisServer {
* Handle a [request] that was read from the communication channel.
*/
void handleRequest(Request request) {
- int count = handlers.length;
- for (int i = 0; i < count; i++) {
- try {
- Response response = handlers[i].handleRequest(request);
- if (response == Response.DELAYED_RESPONSE) {
+ runZoned(() {
+ int count = handlers.length;
+ for (int i = 0; i < count; i++) {
+ try {
+ Response response = handlers[i].handleRequest(request);
+ if (response == Response.DELAYED_RESPONSE) {
+ return;
+ }
+ if (response != null) {
+ channel.sendResponse(response);
+ return;
+ }
+ } on RequestFailure catch (exception) {
+ channel.sendResponse(exception.response);
return;
- }
- if (response != null) {
+ } catch (exception, stackTrace) {
+ _sendServerErrorNotification(exception, stackTrace);
Brian Wilkerson 2014/09/11 22:48:07 Does this mean that we are sending a notification
danrubel 2014/09/11 23:32:08 They are different. Notification is structured to
+ RequestError error =
+ new RequestError(RequestErrorCode.SERVER_ERROR, 'Server Error');
+ Response response = new Response(request.id, error: error);
channel.sendResponse(response);
return;
}
- } on RequestFailure catch (exception) {
- channel.sendResponse(exception.response);
- return;
}
- }
- channel.sendResponse(new Response.unknownRequest(request));
+ channel.sendResponse(new Response.unknownRequest(request));
+ }, onError: _sendServerErrorNotification);
}
/**
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/generated_protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698