fix(channelserver): handle silently swallowed DB scan and exec errors

Several handlers discarded errors from rows.Scan() and db.Exec(),
masking data corruption or connection issues. Scan failures in diva
schedule, event quests, and trend weapons are now logged or returned.
InitializeWarehouse now surfaces its insert error to the caller.
This commit is contained in:
Houmgaor
2026-02-21 13:49:25 +01:00
parent 9da467e00f
commit 3b044fb987
6 changed files with 18 additions and 7 deletions

View File

@@ -97,12 +97,14 @@ func (r *HouseRepository) UpdateMission(charID uint32, data []byte) error {
// Warehouse methods
// InitializeWarehouse ensures a warehouse row exists for the character.
func (r *HouseRepository) InitializeWarehouse(charID uint32) {
func (r *HouseRepository) InitializeWarehouse(charID uint32) error {
var t int
err := r.db.QueryRow(`SELECT character_id FROM warehouse WHERE character_id=$1`, charID).Scan(&t)
if err != nil {
_, _ = r.db.Exec(`INSERT INTO warehouse (character_id) VALUES ($1)`, charID)
_, err = r.db.Exec(`INSERT INTO warehouse (character_id) VALUES ($1)`, charID)
return err
}
return nil
}
const warehouseNamesSQL = `