Skip to content

Commit

Permalink
Limit errors to first 2 (#84)
Browse files Browse the repository at this point in the history
* Limit errors to first 2, fixes grol-io/grol#166

* use 0.53.0 release
  • Loading branch information
ldemailly authored Aug 20, 2024
1 parent 2accd12 commit c296783
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,13 @@ func eval(input string, formatMode, compactMode, verbatimMode bool) string {
}
if len(errs) > 0 {
res += "```diff"
for _, e := range errs {
res += "\n- " + e
for i, e := range errs {
if i >= 2 {
n := len(errs) - i
res += fmt.Sprintf("\n...%d more %s...", n, cli.Plural(n, "error"))
break
}
res += "\n-\t" + strings.Join(strings.Split(e, "\n"), "\n-\t")
}
res += "\n```"
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
fortio.org/scli v1.15.2
fortio.org/version v1.0.4
github.com/bwmarrin/discordgo v0.28.1
grol.io/grol v0.52.0
grol.io/grol v0.53.0
)

// replace grol.io/grol => ../grol
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
grol.io/grol v0.52.0 h1:iSQMXHIIm4NjjpNd1UxRpKS+BICbIwshXvgKYvGWFm0=
grol.io/grol v0.52.0/go.mod h1:auvyNPGD+C1jMFsu+EkAVmXCjweP9qRLoTIYtdfrWiI=
grol.io/grol v0.53.0 h1:QxQVucfU30uo8ZyhIRNeUu7UrAUtjsLMynweXLkd6yA=
grol.io/grol v0.53.0/go.mod h1:auvyNPGD+C1jMFsu+EkAVmXCjweP9qRLoTIYtdfrWiI=

0 comments on commit c296783

Please sign in to comment.