up
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -1194,10 +1195,20 @@ func (a *App) reloadLookupProviders() {
|
||||
|
||||
// --- QSO bindings ---
|
||||
|
||||
func (a *App) AddQSO(q qso.QSO) (int64, error) {
|
||||
func (a *App) AddQSO(q qso.QSO) (id int64, err error) {
|
||||
if a.qso == nil {
|
||||
return 0, fmt.Errorf("db not initialized")
|
||||
}
|
||||
// Never let a panic in the logging path crash the whole app — the user lost
|
||||
// QSOs that way (CW + WinKeyer). Surface it as an error instead.
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
applog.Printf("PANIC in AddQSO: %v\n%s", r, debug.Stack())
|
||||
if id == 0 {
|
||||
err = fmt.Errorf("internal error while logging: %v", r)
|
||||
}
|
||||
}
|
||||
}()
|
||||
a.applyStationDefaults(&q)
|
||||
a.applyDXCCNumber(&q)
|
||||
a.applyClublogException(&q, false) // override entity for date-ranged DXpeditions
|
||||
@@ -1210,7 +1221,7 @@ func (a *App) AddQSO(q qso.QSO) (int64, error) {
|
||||
q.Email = lr.Email
|
||||
}
|
||||
}
|
||||
id, err := a.qso.Add(a.ctx, q)
|
||||
id, err = a.qso.Add(a.ctx, q)
|
||||
if err == nil {
|
||||
q.ID = id
|
||||
a.saveQSORecording(&q)
|
||||
|
||||
Reference in New Issue
Block a user