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

Unified Diff: pkg/json_rpc_2/lib/error_code.dart

Issue 691053006: Add a Client class to json_rpc_2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
Index: pkg/json_rpc_2/lib/error_code.dart
diff --git a/pkg/json_rpc_2/lib/error_code.dart b/pkg/json_rpc_2/lib/error_code.dart
index 96cb909a314c1b43460526939be225fef554c672..f510d8bb5541d517e0ebf69d5f81a744179c0a15 100644
--- a/pkg/json_rpc_2/lib/error_code.dart
+++ b/pkg/json_rpc_2/lib/error_code.dart
@@ -34,3 +34,14 @@ const INTERNAL_ERROR = -32603;
/// The spec reserves the range from -32000 to -32099 for implementation-defined
/// server exceptions, but for now we only use one of those values.
const SERVER_ERROR = -32000;
+
+String name(int errorCode) {
Bob Nystrom 2014/11/03 18:43:55 Doc comment.
nweiz 2014/11/04 02:22:45 Done.
+ switch (errorCode) {
+ case PARSE_ERROR: return "parse error";
+ case INVALID_REQUEST: return "invalid request";
+ case METHOD_NOT_FOUND: return "method not found";
+ case INVALID_PARAMS: return "invalid parameters";
+ case INTERNAL_ERROR: return "internal error";
+ default: return null;
Bob Nystrom 2014/11/03 18:43:55 I can see the value in not throwing an ArgumentErr
nweiz 2014/11/04 02:22:45 These error codes are the ones listed in the spec,
Bob Nystrom 2014/11/04 20:28:16 SGTM.
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698