error handling
This commit is contained in:
parent
35fd08f9e8
commit
d7f138b7b9
@ -127,7 +127,8 @@ func (ad *InfluxDBAdapter) Save(channels []core.Channel) error {
|
|||||||
|
|
||||||
err = ad.client.Write(initContext, []byte(sb.String()))
|
err = ad.client.Write(initContext, []byte(sb.String()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"th7/data/config"
|
"th7/data/config"
|
||||||
@ -83,7 +82,7 @@ func (ad *SQLite3Adapter) Save(channels []core.Channel) error {
|
|||||||
|
|
||||||
_, err = statement.Exec(id, thermo, gain, offset, value, timestamp)
|
_, err = statement.Exec(id, thermo, gain, offset, value, timestamp)
|
||||||
if err != nil {
|
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)
|
fmt.Printf("[%s] SQLite3 log: id=%d, type=%s, gain=%.2f, offset=%.2f, value=%.2f\n", timestamp, id, thermo, gain, offset, value)
|
||||||
|
Loading…
Reference in New Issue
Block a user