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

Filters out Slack events from USLACKBOT #3345

Merged
merged 3 commits into from
May 3, 2023
Merged

Conversation

mvilanova
Copy link
Contributor

No description provided.

@mvilanova mvilanova added the bug Something isn't working label May 2, 2023
@mvilanova mvilanova requested a review from wssheldon May 2, 2023 23:13
@wssheldon
Copy link
Contributor

This message will be surface to the user:

def build_context_error_message(payload: dict, error: Any) -> str:
    message = (
        f"""I see you tried to run `{payload['command']}` in an non-incident conversation. Incident-specifc commands can only be run in incident conversations."""  # command_context_middleware()
        if payload.get("command")
        else str(error)  # everything else
    )
    return message

Is that appropriate for this error case or should we add a new exception type?

@mvilanova
Copy link
Contributor Author

mvilanova commented May 2, 2023

This message will be surface to the user:

def build_context_error_message(payload: dict, error: Any) -> str:
    message = (
        f"""I see you tried to run `{payload['command']}` in an non-incident conversation. Incident-specifc commands can only be run in incident conversations."""  # command_context_middleware()
        if payload.get("command")
        else str(error)  # everything else
    )
    return message

Is that appropriate for this error case or should we add a new exception type?

Yeah, I think that would make sense, as I'm seeing ContextError() being used in other places in the middleware module and I'm not sure there's a lot of value to present them to the user.

@mvilanova mvilanova changed the title Adds logging and exception handling for KeyError exception in user middleware Filters out events by USLACKBOT May 3, 2023
@mvilanova mvilanova changed the title Filters out events by USLACKBOT Filters out Slack events from USLACKBOT May 3, 2023
@mvilanova mvilanova merged commit 21efb66 into master May 3, 2023
@mvilanova mvilanova deleted the bugfix/user-middleware branch May 3, 2023 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants