Don't return INVALID on seed-related function error

better-accounts
maru 2024-05-10 15:44:35 -04:00
parent eea2266920
commit b5e8094039
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D
2 changed files with 4 additions and 4 deletions

View File

@ -72,12 +72,12 @@ func Init() error {
time.Sleep(time.Second)
seed, err = recordNewDaily()
log.Printf("Daily Run Seed: %s", seed)
if err != nil {
log.Printf("error while recording new daily: %s", err)
} else {
log.Printf("Daily Run Seed: %s", seed)
}
})
if err != nil {
return err
}

View File

@ -27,7 +27,7 @@ func TryAddDailyRun(seed string) (string, error) {
var actualSeed string
err := handle.QueryRow("INSERT INTO dailyRuns (seed, date) VALUES (?, UTC_DATE()) ON DUPLICATE KEY UPDATE date = date RETURNING seed", seed).Scan(&actualSeed)
if err != nil {
return "INVALID", err
return "", err
}
return actualSeed, nil
@ -37,7 +37,7 @@ func GetDailyRunSeed() (string, error) {
var seed string
err := handle.QueryRow("SELECT seed FROM dailyRuns WHERE date = UTC_DATE()").Scan(&seed)
if err != nil {
return "INVALID", err
return "", err
}
return seed, nil