From 9c3e8beb21f6af4b90bbbd8fea962ec19ee3eece Mon Sep 17 00:00:00 2001 From: barryz Date: Fri, 26 Jan 2018 23:22:23 +0800 Subject: [PATCH] should return the real error type sent from the server when opening vhost failed --- client_test.go | 4 ++-- connection.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client_test.go b/client_test.go index d10671a5..22fc6bef 100644 --- a/client_test.go +++ b/client_test.go @@ -326,8 +326,8 @@ func TestOpenFailedVhost(t *testing.T) { }() c, err := Open(rwc, defaultConfig()) - if err != ErrVhost { - t.Fatalf("expected ErrVhost got: %+v on %+v", err, c) + if err == nil { + t.Fatalf("expected not nil error got: %+v on %+v", err, c) } } diff --git a/connection.go b/connection.go index 8e62ee96..b837b5df 100644 --- a/connection.go +++ b/connection.go @@ -794,7 +794,7 @@ func (c *Connection) openVhost(config Config) error { if err := c.call(req, res); err != nil { // Cannot be closed yet, but we know it's a vhost problem - return ErrVhost + return err } c.Config.Vhost = config.Vhost