Chromium Code Reviews| Index: runtime/bin/service_object_patch.dart |
| diff --git a/runtime/bin/service_object_patch.dart b/runtime/bin/service_object_patch.dart |
| index fadae3718604500bde0f9aed15569d753a6d90a3..4cdc7877030209e1443fe7074c7ca945b355fe10 100644 |
| --- a/runtime/bin/service_object_patch.dart |
| +++ b/runtime/bin/service_object_patch.dart |
| @@ -19,9 +19,6 @@ String _serviceObjectHandler(List<String> paths, |
| List<String> keys, |
| List<String> values) { |
| assert(keys.length == values.length); |
| - badPath() { |
| - throw "Invalid path '${paths.join("/")}'"; |
| - } |
| if (paths.isEmpty) { |
| return JSON.encode(_ioServiceObject()); |
| } |
| @@ -32,7 +29,7 @@ String _serviceObjectHandler(List<String> paths, |
| i++; |
| } while (i < paths.length && current is Map); |
| if (current is! Function) { |
| - badPath(); |
| + return JSON.encode(_makeServiceError('Unrecognized path')); |
|
Anders Johnsen
2014/05/28 06:53:32
I think we should add the path as well, for debugg
Cutch
2014/05/28 07:07:41
Good catch. We do this on the native side, now we
|
| } |
| var query = new Map(); |
| for (int i = 0; i < keys.length; i++) { |
| @@ -41,6 +38,18 @@ String _serviceObjectHandler(List<String> paths, |
| return JSON.encode(current(paths.sublist(i))); |
| } |
| +Map _makeServiceError(String message, [String kind]) { |
| + var error = { |
| + 'type': 'Error', |
| + 'id': '', |
| + 'message': message, |
| + }; |
| + if (kind != null) { |
| + error['kind'] = kind; |
| + } |
| + return error; |
| +} |
| + |
| Map _ioServiceObject() { |
| return { |
| 'id': 'io', |