Index: mojo/public/js/connector.js |
diff --git a/mojo/public/js/connector.js b/mojo/public/js/connector.js |
index 012e3c7c07b46b12d6490701c20144a4641a9277..4d0627865337f19e231d69306e088054fe9ea36b 100644 |
--- a/mojo/public/js/connector.js |
+++ b/mojo/public/js/connector.js |
@@ -78,6 +78,10 @@ |
this.errorHandler_ = handler; |
}; |
+ Connector.prototype.encounteredError = function() { |
+ return this.error_; |
+ }; |
+ |
Connector.prototype.waitForNextMessageForTesting = function() { |
var wait = core.wait(this.handle_, core.HANDLE_SIGNAL_READABLE); |
this.readMore_(wait.result); |
@@ -92,12 +96,9 @@ |
if (read.result == core.RESULT_SHOULD_WAIT) |
return; |
if (read.result != core.RESULT_OK) { |
- // TODO(wangjimmy): Add a handleError method to swap the handle to be |
- // closed with a dummy handle in the case when |
- // read.result != MOJO_RESULT_FAILED_PRECONDITION |
this.error_ = true; |
if (this.errorHandler_) |
- this.errorHandler_.onError(); |
+ this.errorHandler_.onError(read.result); |
return; |
} |
var messageBuffer = new buffer.Buffer(read.buffer); |