It would be really nice if the adapter didn't panic on recoverable errors x.x

This commit is contained in:
Azareal 2018-08-29 12:09:49 +10:00
parent c20251b462
commit 11303d85c3
1 changed files with 8 additions and 0 deletions

View File

@ -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"]