From 0be787db78388e014ed1712cf906573d2e6bf3df Mon Sep 17 00:00:00 2001 From: Zach Klippenstein Date: Sun, 3 May 2015 18:07:03 -0700 Subject: [PATCH] Better logging for connection failures. --- device_client.go | 2 +- wire/dialer.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/device_client.go b/device_client.go index 8a3d503..ea5961c 100644 --- a/device_client.go +++ b/device_client.go @@ -147,7 +147,7 @@ func (c *DeviceClient) getAttribute(attr string) (string, error) { func (c *DeviceClient) dialDevice() (*wire.Conn, error) { conn, err := c.dialer.Dial() if err != nil { - return nil, fmt.Errorf("error dialing adb server: %+v", err) + return nil, fmt.Errorf("error dialing adb server (%s): %+v", c.dialer, err) } req := fmt.Sprintf("host:%s", c.descriptor.getTransportDescriptor()) diff --git a/wire/dialer.go b/wire/dialer.go index 6473ead..cb21431 100644 --- a/wire/dialer.go +++ b/wire/dialer.go @@ -23,6 +23,10 @@ func NewDialer(host string, port int) Dialer { return &netDialer{host, port} } +func (d *netDialer) String() string { + return fmt.Sprintf("netDialer(%s:%d)", d.Host, d.Port) +} + // Dial connects to the adb server on the host and port set on the netDialer. // The zero-value will connect to the default, localhost:5037. func (d *netDialer) Dial() (*Conn, error) {