Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants