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

Handle invalid commands #1053

Merged

Conversation

huseyinbabal
Copy link
Contributor

@huseyinbabal huseyinbabal commented May 9, 2023

Description

Changes proposed in this pull request:

  • Built-in commands now returns more meaningful error messages

Examples

Screen Shot 2023-05-09 at 16 05 17
Screen Shot 2023-05-09 at 16 05 24

Testing

  • Run botkube with default settings
  • Try built-in commands with invalid/obsolete params like @Botkube ping test, @Botkube list non-arg

Related issue(s)

#974

@huseyinbabal huseyinbabal linked an issue May 9, 2023 that may be closed by this pull request
@huseyinbabal huseyinbabal marked this pull request as ready for review May 9, 2023 15:04
@huseyinbabal huseyinbabal requested a review from a team May 9, 2023 15:04
@huseyinbabal huseyinbabal requested a review from PrasadG193 as a code owner May 9, 2023 15:04
@huseyinbabal huseyinbabal requested a review from josefkarasek May 9, 2023 15:04
@@ -168,8 +170,9 @@ func (e *DefaultExecutor) Execute(ctx context.Context) interactive.CoreMessage {
reportedCmd = fmt.Sprintf("%s {invalid feature}", reportedCmd)
}
e.reportCommand(ctx, "", reportedCmd, false, cmdCtx)
msg := e.cmdsMapping.HelpMessageForVerb(cmdVerb)
return respond(msg, cmdCtx)
helmMsg := e.cmdsMapping.HelpMessageForVerb(cmdVerb)

Choose a reason for hiding this comment

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

I think you want helpMsg, not helm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, thanks

Copy link

@josefkarasek josefkarasek left a comment

Choose a reason for hiding this comment

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

lgtm

@huseyinbabal huseyinbabal merged commit 760e70d into kubeshop:main May 9, 2023
@huseyinbabal huseyinbabal deleted the invalid-command-error-handling branch May 9, 2023 16:13
pkosiec pushed a commit to pkosiec/botkube that referenced this pull request May 11, 2023
pkosiec pushed a commit that referenced this pull request May 11, 2023
(cherry picked from commit 760e70d)
@pkosiec pkosiec added the enhancement New feature or request label Jun 15, 2023
@pkosiec pkosiec changed the title handle invalid commands Handle invalid commands Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Botkube doesn't return error on invalid built-in commands
3 participants