Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle participant dropping before deck submission is approved #512

Open
kevinlul opened this issue May 13, 2023 · 0 comments
Open

Handle participant dropping before deck submission is approved #512

kevinlul opened this issue May 13, 2023 · 0 comments
Labels
bug Something isn't working manual-tournaments

Comments

@kevinlul
Copy link
Contributor

When a participant drops (or leaves the server) before a deck submission is approved, once a host clicks either accept button, the error flow is not properly handled.

Example logs at error level:

EntityNotFoundError: Could not find any entity of type "ManualDeckSubmission" matching: {
    "where": {
        "discordId": "REDACTED",
        "tournamentId": REDACTED
    }
}
    at <anonymous> (/app/node_modules/typeorm/entity-manager/src/entity-manager/EntityManager.ts:1252:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at AcceptButtonHandler.click (/src/slash/deck.ts:140:16)
    at Client.interactionCreate (/src/events/interaction.ts:112:4)
EntityNotFoundError: Could not find any entity of type "ManualDeckSubmission" matching: {
    "where": {
        "discordId": "REDACTED",
        "tournamentId": REDACTED
    }
}
    at <anonymous> (/app/node_modules/typeorm/entity-manager/src/entity-manager/EntityManager.ts:1252:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at approveDeck (/src/slash/deck.ts:169:15)
    at QuickAcceptButtonHandler.click (/src/slash/deck.ts:209:3)
    at Client.interactionCreate (/src/events/interaction.ts:112:4)

https://github.com/DawnbrandBots/emcee-tournament-bot/blob/master/src/slash/deck.ts#L140
https://github.com/DawnbrandBots/emcee-tournament-bot/blob/master/src/slash/deck.ts#L169

The EntityNotFoundError from ManualDeckSubmission.findOneOrFail is not handled, so it propagates up the handlers all the way until the "error" listener on the bot instance logs it. Instead, this should use findOne, and in the null/undefined case, the host should be notified appropriately via Discord, like the 🐌 OUTDATED case.

@kevinlul kevinlul added bug Something isn't working manual-tournaments labels May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working manual-tournaments
Projects
None yet
Development

No branches or pull requests

1 participant