From f0b6124f44e208e8b0ce63fe2cc5177b0e09e5ee Mon Sep 17 00:00:00 2001 From: Warnar Boekkooi Date: Fri, 31 Jan 2020 15:50:44 +0100 Subject: [PATCH] Fix nil pointer exception when DSN is wrong --- pkg/reader/reader.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/reader/reader.go b/pkg/reader/reader.go index ab12c8f..fb68fb1 100644 --- a/pkg/reader/reader.go +++ b/pkg/reader/reader.go @@ -1,6 +1,7 @@ package reader import ( + "fmt" "time" "github.com/hellofresh/klepto/pkg/config" @@ -85,5 +86,9 @@ func Connect(opts ConnOpts) (reader Reader, err error) { return false }) + if reader == nil { + err = fmt.Errorf("unsupported dsn %q", opts.DSN) + } + return }