Skip to content

Commit

Permalink
bitbucket: improve error message in case of http error
Browse files Browse the repository at this point in the history
  • Loading branch information
brainexe committed Jul 8, 2024
1 parent 738d043 commit 98a86f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion client/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ func (s *Slack) ReplyError(ref msg.Ref, err error) {
WithField("user", ref.GetUser()).
Warn("Error while sending reply")

s.SendMessage(ref, err.Error())
s.SendMessage(
ref,
err.Error(),
slack.MsgOptionTS(ref.GetTimestamp()),
)

if s.config.ErrorChannel != "" {
text := fmt.Sprintf(
Expand Down
6 changes: 3 additions & 3 deletions command/jenkins/inform_idle.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (c *idleWatcherCommand) GetMatcher() matcher.Matcher {
)
}

// command like "wait until node swarm-1234 is idle"
// command like "wait until jenkins node swarm-1234 is idle"
func (c *idleWatcherCommand) checkSingleNode(match matcher.Result, message msg.Message) {
nodeName := match.GetString("node")

Expand Down Expand Up @@ -131,11 +131,11 @@ func (c *idleWatcherCommand) GetHelp() []bot.Help {
Category: category,
},
{
Command: "wait until node <nodeId> is idle",
Command: "wait until jenkins node <nodeId> is idle",
Description: "Informs you if no Jenkins job is running on the given node anymore. Useful when we're planning updates/maintenance which requires a idle server.",
Examples: []string{
"wait until jenkins is idle",
"wait until node swarm-1234 is idle",
"wait until jenkins node swarm-1234 is idle",
},
Category: category,
},
Expand Down
4 changes: 2 additions & 2 deletions command/pullrequest/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ func (c *bitbucketFetcher) getPullRequest(match matcher.Result) (pullRequest, er
number := match.GetInt("number")
rawResponse, err := c.bitbucketClient.GetPullRequest(project, repo, number)
if err != nil {
// handle deleted PR
// handle deleted PR as already "closed" one
if strings.Contains(err.Error(), "Status: 404") {
return closedPr, nil
}

return pr, err
return pr, errors.Wrap(err, "Error while loading data from Bitbucket:")
}

rawPullRequest, err := bitbucket.GetPullRequestResponse(rawResponse)
Expand Down

0 comments on commit 98a86f2

Please sign in to comment.