fix(channelserver): return error from Save() to prevent misleading success logs

CharacterSaveData.Save() silently returned on failure (nil decompressed
data, compression error, DB error) while the caller unconditionally
logged "Saved character data successfully". This made diagnosing save
failures difficult (ref #163).

Save() now returns an error, and all six call sites check it. The
success log in saveAllCharacterData only fires when the save actually
persisted.
This commit is contained in:
Houmgaor
2026-02-27 11:21:37 +01:00
parent 178a008e25
commit 74798fc8b3
7 changed files with 32 additions and 9 deletions

View File

@@ -194,7 +194,14 @@ func saveAllCharacterData(s *Session, rpToAdd int) error {
}
// Save to database (main savedata + user_binary)
characterSaveData.Save(s)
if err := characterSaveData.Save(s); err != nil {
s.logger.Error("Failed to save character data",
zap.Error(err),
zap.Uint32("charID", s.charID),
zap.String("name", s.Name),
)
return err
}
// Save auxiliary data types
// Note: Plate data saves immediately when client sends save packets,