From 8ddd2beaee34736502ae7cc96860fb6ec3f52352 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Thu, 26 Jan 2017 16:34:09 +0200 Subject: [PATCH] Fix error message for Go 1.8. --- options.go | 3 ++- options_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/options.go b/options.go index a7f7fd76..bab7d4d5 100644 --- a/options.go +++ b/options.go @@ -3,6 +3,7 @@ package redis import ( "crypto/tls" "errors" + "fmt" "net" "net/url" "strconv" @@ -151,7 +152,7 @@ func ParseURL(redisURL string) (*Options, error) { o.DB = 0 case 1: if o.DB, err = strconv.Atoi(f[0]); err != nil { - return nil, errors.New("invalid redis database number: " + err.Error()) + return nil, fmt.Errorf("invalid redis database number: %q", f[0]) } default: return nil, errors.New("invalid redis URL path: " + u.Path) diff --git a/options_test.go b/options_test.go index effebd5a..6a4af716 100644 --- a/options_test.go +++ b/options_test.go @@ -63,7 +63,7 @@ func TestParseURL(t *testing.T) { { "redis://localhost/iamadatabase", "", - 0, false, errors.New("invalid redis database number: strconv.ParseInt: parsing \"iamadatabase\": invalid syntax"), + 0, false, errors.New(`invalid redis database number: "iamadatabase"`), }, }