diff --git a/utils/queries.go b/utils/queries.go index 4fd3b9e..1688d56 100644 --- a/utils/queries.go +++ b/utils/queries.go @@ -39,7 +39,7 @@ func GetRecord(entry Record) Record { result, sqlErr = sqlCheckForRecord(redisKey, entry.Fqdn, entry) if sqlErr == 1 { logrus.Debug("QUERIES : Check for wildcard reverse in MySQL") - result, redisErr = sqlCheckForReverse6Wildcard(redisKey, entry.Fqdn, entry) + result, _ = sqlCheckForReverse6Wildcard(redisKey, entry.Fqdn, entry) } } @@ -68,7 +68,7 @@ func GetRecord(entry Record) Record { if sqlErr == 1 { //Check for wildcard record in mysql logrus.Debug("QUERIES : Check for wildcard in MSQL") - result, sqlErr = sqlCheckForRecord(redismdKey, fmt.Sprint(mainDomainKey), entry) + result, _ = sqlCheckForRecord(redismdKey, fmt.Sprint(mainDomainKey), entry) } } } diff --git a/utils/redis.go b/utils/redis.go index 2291951..9197346 100644 --- a/utils/redis.go +++ b/utils/redis.go @@ -24,6 +24,7 @@ func RedisDatabase(conf *Conf) *redis.Client { //Test Redis connection err := rdb.Set(ctx, "alive", 1, 0).Err() + CheckErr(err) alive, err := rdb.Get(ctx, "alive").Result() CheckErr(err) if alive != "1" { diff --git a/utils/sql.go b/utils/sql.go index a18a16b..a51597a 100644 --- a/utils/sql.go +++ b/utils/sql.go @@ -66,6 +66,7 @@ func sqlCheckForReverse6Wildcard(redisKey string, dKey string, entry Record) (Re returnedEntry := entry results, err := DB.Query("SELECT id, content, name FROM records WHERE name LIKE '*%.ip6.arpa.';") + DbgErr(err) for results.Next() { err = results.Scan(&returnedEntry.Id, &returnedEntry.Content, &returnedEntry.Fqdn) diff --git a/utils/utils.go b/utils/utils.go index df8c130..48f05e2 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -17,6 +17,14 @@ func CheckErr(err error) { } } +//Only used for non fatal errors. +func DbgErr(err error) { + if err != nil { + log.Errorf("%s\n ", err.Error()) + panic(err) + } +} + func InitLogger(conf *Conf) { var logLevel = logrus.InfoLevel