[FIDL] Add some information to error messages

Added some more info in the places where it might be helful. It seems
like ctrl.proxyError already adds the interface name in both the sync
and async cases, so it's just completer and future errors.

Test: these are just modifications to print statements, and the dart
analyzer does not have issues with them.

Change-Id: Ifc572b1aa067890eaaad656f7cc55e99034f5ad2
diff --git a/bin/fidlgen_dart/backend/templates/interface.tmpl.go b/bin/fidlgen_dart/backend/templates/interface.tmpl.go
index a2b8549..4b10351 100644
--- a/bin/fidlgen_dart/backend/templates/interface.tmpl.go
+++ b/bin/fidlgen_dart/backend/templates/interface.tmpl.go
@@ -585,7 +585,7 @@
     @override
     {{ template "AsyncReturn" . }} {{ .Name }}({{ template "AsyncParams" .Request }}) async {
       if (!ctrl.isBound) {
-        return new Future.error(new $fidl.FidlStateException('The proxy is closed.'), StackTrace.current);
+        return new Future.error(new $fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'), StackTrace.current);
       }
 
       final $fidl.Encoder $encoder = new $fidl.Encoder();
diff --git a/public/dart/fidl/lib/src/interface.dart b/public/dart/fidl/lib/src/interface.dart
index 9e63f4d..60c7e8e 100644
--- a/public/dart/fidl/lib/src/interface.dart
+++ b/public/dart/fidl/lib/src/interface.dart
@@ -293,7 +293,8 @@
   void _handleReadable() {
     final ReadResult result = _reader.channel.queryAndRead();
     if ((result.bytes == null) || (result.bytes.lengthInBytes == 0))
-      throw new FidlError('Unexpected empty message or error: $result');
+      throw new FidlError('Unexpected empty message or error: $result '
+          'from channel ${_reader.channel}');
 
     final Message message = new Message.fromReadResult(result);
     handleMessage(message, sendMessage);
@@ -498,7 +499,7 @@
     _callbackMap.clear();
     _errorCompleter = new Completer<ProxyError>();
     if (!_boundCompleter.isCompleted) {
-      _boundCompleter.completeError('The proxy closed.');
+      _boundCompleter.completeError('Proxy<${$interfaceName}> closed.');
     }
     _boundCompleter = new Completer<Null>();
     _nextTxid = 1;
@@ -508,7 +509,7 @@
   void _handleReadable() {
     final ReadResult result = _reader.channel.queryAndRead();
     if ((result.bytes == null) || (result.bytes.lengthInBytes == 0)) {
-      proxyError('Read from channel failed');
+      proxyError('Read from channel ${_reader.channel} failed');
       return;
     }
     try {
diff --git a/public/dart/fidl/lib/src/interface_async.dart b/public/dart/fidl/lib/src/interface_async.dart
index f9a6229..01900bf 100644
--- a/public/dart/fidl/lib/src/interface_async.dart
+++ b/public/dart/fidl/lib/src/interface_async.dart
@@ -413,7 +413,7 @@
 
   /// Log an [error] message and close the channel.
   void proxyError(FidlError error) {
-    print('Proxy error: ${error.message}');
+    print('AsyncProxyController<${$interfaceName}> error: ${error.message}');
     close();
   }