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

Unified Diff: pkg/json_rpc_2/test/server/server_test.dart

Issue 224903010: Pass RpcException error data through if it's not a map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 9 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/json_rpc_2/test/server/parameters_test.dart ('k') | pkg/json_rpc_2/test/server/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/json_rpc_2/test/server/server_test.dart
diff --git a/pkg/json_rpc_2/test/server/server_test.dart b/pkg/json_rpc_2/test/server/server_test.dart
index fc3adb527efc8783374632b612ba3cf7e614a02e..c18a8caeb89cc0596a5a1b5784bd0d102561115c 100644
--- a/pkg/json_rpc_2/test/server/server_test.dart
+++ b/pkg/json_rpc_2/test/server/server_test.dart
@@ -92,6 +92,22 @@ void main() {
}), completion(isNull));
});
+ test("includes the error data in the response", () {
+ server.registerMethod('foo', (params) {
+ throw new json_rpc.RpcException(5, 'Error message.', data: 'data value');
+ });
+
+ expectErrorResponse(server, {
+ 'jsonrpc': '2.0',
+ 'method': 'foo',
+ 'params': {},
+ 'id': 1234
+ },
+ 5,
+ 'Error message.',
+ data: 'data value');
+ });
+
group("JSON", () {
test("handles a request parsed from JSON", () {
server.registerMethod('foo', (params) {
« no previous file with comments | « pkg/json_rpc_2/test/server/parameters_test.dart ('k') | pkg/json_rpc_2/test/server/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698