Skip to content

fix(firearms): creating and editing a firearm report the error with the deleteFailed key #200

Description

@seketman

Problem

createFirearm and updateFirearm report their operation's error using the translation key for deletion:

// src/lib/actions/firearms.ts:60  (createFirearm)
if (error) redirectWithError("/firearms", t("deleteFailed", { error }), locale);

// src/lib/actions/firearms.ts:104 (updateFirearm)
if (error) redirectWithError("/firearms", t("deleteFailed", { error }), locale);

Impact

If creating a firearm fails, the user reads "the firearm could not be deleted". Confusing, and it makes a good bug report less likely.

Suggested direction

Add createFailed and updateFailed to actionError in messages/{es,en}.json and use them. updateFailed is already defined (used by matches/[id]/actions.ts:194), so adding createFailed is probably enough.

Found during a full code audit. One line per site.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions