error handling

This commit is contained in:
William Clark 2023-11-23 20:55:10 +00:00
parent 35fd08f9e8
commit d7f138b7b9
2 changed files with 3 additions and 3 deletions

View File

@ -127,7 +127,8 @@ func (ad *InfluxDBAdapter) Save(channels []core.Channel) error {
err = ad.client.Write(initContext, []byte(sb.String()))
if err != nil {
panic(err)
return err
}
return nil
}

View File

@ -4,7 +4,6 @@ import (
"database/sql"
"errors"
"fmt"
"log"
"sync"
"th7/data/config"
@ -83,7 +82,7 @@ func (ad *SQLite3Adapter) Save(channels []core.Channel) error {
_, err = statement.Exec(id, thermo, gain, offset, value, timestamp)
if err != nil {
log.Fatalln(err.Error())
return err
}
fmt.Printf("[%s] SQLite3 log: id=%d, type=%s, gain=%.2f, offset=%.2f, value=%.2f\n", timestamp, id, thermo, gain, offset, value)