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

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

Issue 532403002: Fix error handling in analysis.getError. (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 unified diff | Download patch | Annotate | Revision Log
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 protocol; 5 library protocol;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:analysis_server/src/computer/element.dart' show 10 import 'package:analysis_server/src/computer/element.dart' show
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 decodedResult = result; 844 decodedResult = result;
845 } 845 }
846 return new Response(id, error: decodedError, 846 return new Response(id, error: decodedError,
847 result: decodedResult); 847 result: decodedResult);
848 } catch (exception) { 848 } catch (exception) {
849 return null; 849 return null;
850 } 850 }
851 } 851 }
852 852
853 /** 853 /**
854 * Initialize a newly created instance to represent an error condition caused 854 * Initialize a newly created instance to represent the
855 * by an error during `analysis.getErrors`. 855 * GET_ERRORS_INVALID_FILE error condition.
856 */ 856 */
857 Response.getErrorsError(Request request, String message, 857 Response.getErrorsInvalidFile(Request request)
858 Map<String, Object> result)
859 : this( 858 : this(
860 request.id, 859 request.id,
861 error: new RequestError(RequestErrorCode.GET_ERRORS_ERROR, 'Error during `analysis.getErrors`: $message.'), 860 error: new RequestError(RequestErrorCode.GET_ERRORS_INVALID_FILE,
862 result: result); 861 'Error during `analysis.getErrors`: invalid file.'));
863 862
864 /** 863 /**
865 * Initialize a newly created instance to represent an error condition caused 864 * Initialize a newly created instance to represent an error condition caused
866 * by a [request] that had invalid parameter. [path] is the path to the 865 * by a [request] that had invalid parameter. [path] is the path to the
867 * invalid parameter, in Javascript notation (e.g. "foo.bar" means that the 866 * invalid parameter, in Javascript notation (e.g. "foo.bar" means that the
868 * parameter "foo" contained a key "bar" whose value was the wrong type). 867 * parameter "foo" contained a key "bar" whose value was the wrong type).
869 * [expectation] is a description of the type of data that was expected. 868 * [expectation] is a description of the type of data that was expected.
870 */ 869 */
871 Response.invalidParameter(Request request, String path, String expectation) 870 Response.invalidParameter(Request request, String path, String expectation)
872 : this(request.id, error: new RequestError(RequestErrorCode.INVALID_PARAME TER, 871 : this(request.id, error: new RequestError(RequestErrorCode.INVALID_PARAME TER,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); 946 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
948 hash = hash ^ (hash >> 11); 947 hash = hash ^ (hash >> 11);
949 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); 948 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
950 } 949 }
951 950
952 static int hash2(a, b) => finish(combine(combine(0, a), b)); 951 static int hash2(a, b) => finish(combine(combine(0, a), b));
953 952
954 static int hash4(a, b, c, d) => 953 static int hash4(a, b, c, d) =>
955 finish(combine(combine(combine(combine(0, a), b), c), d)); 954 finish(combine(combine(combine(combine(0, a), b), c), d));
956 } 955 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698