Skip to content

Topic plugin bad at handling empty topics #157

@alanbriolat

Description

@alanbriolat

Exceptions happen when the !topic command is used in a channel with no topic. Ideally should add test coverage and then fix the behaviour.

Empty topic represented as None?

Traceback (most recent call last):
  File "/app/csbot/core.py", line 175, in fire_command
    yield from f(event)
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 212, in coro
    res = func(*args, **kw)
  File "/app/csbot/plugin.py", line 30, in __call__
    return getattr(self.obj, self.name)(*args, **kwargs)
  File "/app/csbot/plugins/topic.py", line 117, in topic_append
    parts = self._split_topic(delim, self._get_topic(e['channel']))
  File "/app/csbot/plugins/topic.py", line 59, in _split_topic
    return [s.strip() for s in topic.split(sep)]
AttributeError: 'NoneType' object has no attribute 'split'

No observed TOPIC message?

Traceback (most recent call last):
  File "/app/csbot/core.py", line 175, in fire_command
    yield from f(event)
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 212, in coro
    res = func(*args, **kw)
  File "/app/csbot/plugin.py", line 30, in __call__
    return getattr(self.obj, self.name)(*args, **kwargs)
  File "/app/csbot/plugins/topic.py", line 89, in topic
    topic = self._get_topic(e['channel'])
  File "/app/csbot/plugins/topic.py", line 71, in _get_topic
    return self.topics[channel][-1]
IndexError: deque index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions