diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-08-02 19:20:25 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-08-02 19:20:25 +0900 |
| commit | b04e76be78398b5739e27cc0cc606a6c1ac8c232 (patch) | |
| tree | 099d201a198d9d5d6213fb95925765ffeb7718d0 /engine/src | |
| parent | 1510404f1f8cf31696fb4ca7457955842267b631 (diff) | |
| download | LunaticChat-b04e76be78398b5739e27cc0cc606a6c1ac8c232.tar.gz LunaticChat-b04e76be78398b5739e27cc0cc606a6c1ac8c232.tar.bz2 LunaticChat-b04e76be78398b5739e27cc0cc606a6c1ac8c232.zip | |
refactor: express command outcomes as message keys
Eighty-nine call sites spelled out the same four-line nest to say "fail
with localized message X":
CommandResult.Failure(
MessageFormatter.formatError(
languageManager.getMessage("channel.ban.noPermission"),
),
)
The pairing of formatError with getMessage was a convention held together
only by copy-paste, so changing how command errors are presented meant
touching all eighty-nine. fail() and ok() on LunaticCommandBase own that
pairing now, and the call sites read as the intent: fail("channel.ban.noPermission").
Three when(error) blocks turned out to map every arm to the same message,
and ChannelCreateCommand ran two parallel whens over one error to pick a
key and its parameters separately. Both were only visible once the noise
around them was gone.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'engine/src')
0 files changed, 0 insertions, 0 deletions
