Skip to content

An empty Discord reply crashes with IndexError instead of a clear error #66

Description

@ldbumble

outbound.reply_to_message splits a Discord reply into pieces and returns the first piece's result. A blank body ('' or only spaces) splits into no pieces, so sent[0] raises IndexError: list index out of range - the owner sees a crash instead of a sentence.

Where: taskuary/outbound.py, the if ch == 'discord': branch of reply_to_message.

Done when a blank body raises a RuntimeError saying there is nothing to send (the way other refusals in this file read), and nothing is posted to Discord.

Test - tests/test_reply_channels.py, next to DiscordReplyTests: with taskuary.devtools.discord_send mocked, reply_to_message(s, msg, ' ') raises RuntimeError and the mock was never called.


Getting started: pip install -e ".[dev]", then python -m pytest -q (offline, a few seconds). UI work: cd website && npm ci && npm test. See CONTRIBUTING.md. One small PR with the change and its test is perfect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconnectorNew ingest channel or report sourcegood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions