| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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("proxy"); | 5 #library("proxy"); |
| 6 #import("dart:isolate"); | 6 #import("dart:isolate"); |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Base class for all RpcProxy's | 9 * Base class for all RpcProxy's |
| 10 * | 10 * |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 static final String prefix = "RpcException:"; | 215 static final String prefix = "RpcException:"; |
| 216 | 216 |
| 217 final String message; | 217 final String message; |
| 218 const RpcException(String this.message); | 218 const RpcException(String this.message); |
| 219 | 219 |
| 220 String toString() { | 220 String toString() { |
| 221 return message; | 221 return message; |
| 222 } | 222 } |
| 223 | 223 |
| 224 static String format(Object e) { | 224 static String format(Object e) { |
| 225 return prefix + e.toString(); | 225 return "$prefix$e"; |
| 226 } | 226 } |
| 227 | 227 |
| 228 static RpcException parse(Object object) { | 228 static RpcException parse(Object object) { |
| 229 if (object === null || !(object is String)) { | 229 if (object === null || !(object is String)) { |
| 230 return null; | 230 return null; |
| 231 } | 231 } |
| 232 String s = object; | 232 String s = object; |
| 233 if (!s.startsWith(prefix)) { | 233 if (!s.startsWith(prefix)) { |
| 234 return null; | 234 return null; |
| 235 } | 235 } |
| 236 return new RpcException(s.substring(prefix.length, s.length)); | 236 return new RpcException(s.substring(prefix.length, s.length)); |
| 237 } | 237 } |
| 238 } | 238 } |
| OLD | NEW |