Skip to content

Commit

Permalink
test: add unit tests for engine exec
Browse files Browse the repository at this point in the history
  • Loading branch information
shay2025 committed Jul 28, 2022
1 parent 5596f85 commit 3c115a2
Show file tree
Hide file tree
Showing 3 changed files with 608 additions and 2 deletions.
12 changes: 11 additions & 1 deletion engine/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"
"regexp"

"github.com/google/go-github/v42/github"
"github.com/reviewpad/reviewpad/v3/utils/fmtio"
)

Expand All @@ -24,9 +25,18 @@ func execLog(val string) {
}

func CollectError(env *Env, err error) {
var errDetails string
ghError, isGitHubError := err.(*github.ErrorResponse)

if isGitHubError {
errDetails = ghError.Message
} else {
errDetails = err.Error()
}

env.Collector.Collect("Error", map[string]interface{}{
"pullRequestUrl": env.PullRequest.URL,
"details": err.Error(),
"details": errDetails,
})
}

Expand Down
Loading

0 comments on commit 3c115a2

Please sign in to comment.