Commit Graph

16 Commits

Author SHA1 Message Date
Houmgaor
f640cfee27 fix: log SJIS decoding errors instead of silently discarding them
Add SJISToUTF8Lossy() that wraps SJISToUTF8() and logs decode errors at
slog.Debug level. Replace all 31 call sites across 17 files that previously
discarded the error with `_, _ =`. This makes garbled text from malformed
SJIS client data debuggable without adding noise at default log levels.
2026-02-22 17:01:22 +01:00
Houmgaor
d32e77efba refactor: replace panic calls with structured error handling
Replace ~25 panic() calls in non-fatal code paths with proper
s.logger.Error + return patterns. Panics in handler code crashed
goroutines (caught by defer/recover but still disruptive) instead
of failing gracefully.

Key changes:
- SJISToUTF8 now returns (string, error); all 30+ callers updated
- Handler DB/IO panics replaced with log + return/ack fail
- Unhandled switch-case panics replaced with logger.Error
- Sign server Accept() panic replaced with log + continue
- Dead unreachable panic in guild_model.go removed
- deltacomp patch error logs and returns partial data

Panics intentionally kept: ByteFrame sentinel, unimplemented
packet stubs, os.Exit in main.go.
2026-02-20 19:11:41 +01:00
Houmgaor
2bd5f98f32 docs: add doc.go files and godoc comments to all packages
Add package-level documentation (doc.go) to all 22 first-party
packages and godoc comments to ~150 previously undocumented
exported symbols across common/, network/, and server/.
2026-02-18 21:39:13 +01:00
Houmgaor
9b69564c49 fix: prevent server crash on unsupported Shift-JIS characters (#116)
UTF8ToSJIS panicked when encountering characters outside the Shift-JIS
range (emoji, Lenny faces, cuneiform, etc.), crashing the server when
such characters were sent via the Discord relay channel.

Replace the panic with graceful filtering that drops unmappable runes
and preserves valid content. Also fix ToNGWord index-out-of-range panic
on empty encoder output.

Closes #116
2026-02-16 18:16:42 +01:00
Houmgaor
a6cf550fdb tests(common): comprehensive code coverage for common 2025-10-27 12:59:22 +01:00
Houmgaor
c55f23442b fix(lint): fixing go static check failing. 2025-10-19 22:52:58 +02:00
wish
632aa081b9 decode SMC table 2024-07-16 00:57:59 +10:00
wish
0caaeac3af initial ngword commit 2024-07-15 01:07:50 +10:00
wish
bcf2ba40e5 fix possible integer bounding issues 2023-11-20 00:13:49 +11:00
wish
2c8391b5a4 various Tower changes 2023-06-11 18:51:56 +10:00
wish
3be014ba7f remove unused code 2023-04-11 21:07:43 +10:00
wish
a2a4989cda replace outdated code 2023-03-12 23:36:26 +11:00
wish
ed3687548c prevent CSVs from adding existing values 2022-08-16 21:03:30 +10:00
wish
816ff0eac5 correct failsafe size on PaddedString transform fail 2022-08-04 22:55:32 +10:00
wish
556198af72 softfail on paddedstring and login cleanup 2022-08-04 21:01:32 +10:00
wish
2c0e7a5267 repository cleanup 2022-07-29 03:25:23 +10:00