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

Unified Diff: runtime/bin/service_object_patch.dart

Issue 300883002: Add Proces owner of socket and fix printing of non-network sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 | « runtime/bin/process_patch.dart ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b71497120df152b1b8ed948f042104ab25bc2c75 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,8 @@ String _serviceObjectHandler(List<String> paths,
i++;
} while (i < paths.length && current is Map);
if (current is! Function) {
- badPath();
+ return JSON.encode(_makeServiceError('Unrecognized path', paths, keys,
+ values));
}
var query = new Map();
for (int i = 0; i < keys.length; i++) {
@@ -41,6 +39,27 @@ String _serviceObjectHandler(List<String> paths,
return JSON.encode(current(paths.sublist(i)));
}
+Map _makeServiceError(String message,
+ List<String> paths,
+ List<String> keys,
+ List<String> values,
+ [String kind]) {
+ var error = {
+ 'type': 'Error',
+ 'id': '',
+ 'message': message,
+ 'request': {
+ 'arguments': paths,
+ 'option_keys': keys,
+ 'option_values': values,
+ }
+ };
+ if (kind != null) {
+ error['kind'] = kind;
+ }
+ return error;
+}
+
Map _ioServiceObject() {
return {
'id': 'io',
« no previous file with comments | « runtime/bin/process_patch.dart ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698