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

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
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',

Powered by Google App Engine
This is Rietveld 408576698