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

Side by Side Diff: pkg/json_rpc_2/lib/src/exception.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/json_rpc_2/lib/src/client.dart ('k') | pkg/json_rpc_2/lib/src/server.dart » ('j') | 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 json_rpc_2.exception; 5 library json_rpc_2.exception;
6 6
7 import '../error_code.dart' as error_code; 7 import '../error_code.dart' as error_code;
8 8
9 /// An exception from a JSON-RPC server that can be translated into an error 9 /// An exception from a JSON-RPC server that can be translated into an error
10 /// response. 10 /// response.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 var id = request is Map ? request['id'] : null; 59 var id = request is Map ? request['id'] : null;
60 if (id is! String && id is! num) id = null; 60 if (id is! String && id is! num) id = null;
61 return { 61 return {
62 'jsonrpc': '2.0', 62 'jsonrpc': '2.0',
63 'error': {'code': code, 'message': message, 'data': modifiedData}, 63 'error': {'code': code, 'message': message, 'data': modifiedData},
64 'id': id 64 'id': id
65 }; 65 };
66 } 66 }
67
68 String toString() {
69 var prefix = "JSON-RPC error $code";
70 var errorName = error_code.name(code);
71 if (errorName != null) prefix += " ($errorName)";
72 return "$prefix: $message";
73 }
67 } 74 }
OLDNEW
« no previous file with comments | « pkg/json_rpc_2/lib/src/client.dart ('k') | pkg/json_rpc_2/lib/src/server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698