From 11303d85c3c95613d7fa446c1cea01926442e85b Mon Sep 17 00:00:00 2001 From: Azareal Date: Wed, 29 Aug 2018 12:09:49 +1000 Subject: [PATCH] It would be really nice if the adapter didn't panic on recoverable errors x.x --- query_gen/lib/mysql.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/query_gen/lib/mysql.go b/query_gen/lib/mysql.go index bdf725f7..8109cbaa 100644 --- a/query_gen/lib/mysql.go +++ b/query_gen/lib/mysql.go @@ -4,6 +4,7 @@ package qgen import ( "database/sql" "errors" + "fmt" "runtime" "strconv" "strings" @@ -51,6 +52,13 @@ func (adapter *MysqlAdapter) BuildConn(config map[string]string) (*sql.DB, error // First try opening a pipe as those are faster if runtime.GOOS == "linux" { + // The adapter seems to be panicking when encountering a recoverable error x.x + defer func() { + if r := recover(); r != nil { + fmt.Println("Recovered in f", r) + } + }() + var dbsocket = "/tmp/mysql.sock" if config["socket"] != "" { dbsocket = config["socket"]