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

Made it so Sopel doesn't automatically message who triggered an error. #1071

Merged
merged 6 commits into from
Apr 28, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sopel/config/core_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ def homedir(self):
'DEBUG'],
'WARNING')
"""The lowest severity of logs to display."""

message_logs = ValidatedAttribute('log_to_channel',bool,default=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be used at all.

"""Whether to message the logging channel with thrown exceptions."""

message_logs_sender = ValidatedAttribute('message_logs_sender',bool,default=False)
"""Whether to message the sender of a message that triggered an error with the exception."""

modes = ValidatedAttribute('modes', default='B')
"""User modes to be set on connection."""
Expand Down
16 changes: 11 additions & 5 deletions sopel/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,18 @@ def error(self, trigger=None):
except Exception as e:
stderr("Could not save full traceback!")
LOGGER.error("Could not save traceback from %s to file: %s", trigger.sender, str(e))

if trigger and trigger.sender is not None:
self.msg(trigger.sender, signature)

# Errors will pass silently otherwise, not sure how to handle this
if trigger and self.config.core.message_logs and self.config.core.logging_channel is not None:
self.msg(self.config.logging_channel, signature)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here, this should be done via LOGGER.

if self.config.core.message_logs_sender:
self.msg(trigger.sender,signature)
except Exception as e:
if trigger and trigger.sender is not None:
self.msg(trigger.sender, "Got an error.")
if trigger:
if self.config.core.message_logs and self.config.core.logging_channel is not None:
self.msg(self.config.core.logging_channel,"Got an error.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this line, LOGGER.error is sent to the logging_channel just below and that's more verbose than this is.

if self.config.core.message_logs_sender:
self.msg(trigger.sender,"Got an error.")
LOGGER.error("Exception from %s: %s", trigger.sender, str(e))

def handle_error(self):
Expand Down