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

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: Code review changes Created 6 years, 1 month 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/json_rpc_2/CHANGELOG.md ('k') | pkg/json_rpc_2/lib/json_rpc_2.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a9be638be678347ca749fa5e416538375c005f5d 100644
--- a/pkg/json_rpc_2/lib/error_code.dart
+++ b/pkg/json_rpc_2/lib/error_code.dart
@@ -34,3 +34,18 @@ 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;
+
+/// Returns a human-readable name for [errorCode] if it's one specified by the
+/// JSON-RPC 2.0 spec.
+///
+/// If [errorCode] isn't specified, returns null.
Bob Nystrom 2014/11/04 20:28:16 "specified" is a bit ambiguous here. The reader co
nweiz 2014/11/05 23:23:39 Done.
+String name(int errorCode) {
+ 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;
+ }
+}
« no previous file with comments | « pkg/json_rpc_2/CHANGELOG.md ('k') | pkg/json_rpc_2/lib/json_rpc_2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698