mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-03 00:57:52 +02:00
use fork of roll that doesn't care about errors
This commit is contained in:
0
vendor/github.com/stvp/roll/LICENSE → vendor/github.com/jesseduffield/roll/LICENSE
generated
vendored
0
vendor/github.com/stvp/roll/LICENSE → vendor/github.com/jesseduffield/roll/LICENSE
generated
vendored
6
vendor/github.com/stvp/roll/client.go → vendor/github.com/jesseduffield/roll/client.go
generated
vendored
6
vendor/github.com/stvp/roll/client.go → vendor/github.com/jesseduffield/roll/client.go
generated
vendored
@ -203,7 +203,8 @@ func (c *rollbarClient) send(item map[string]interface{}) (uuid string, err erro
|
||||
|
||||
resp, err := http.Post(Endpoint, "application/json", bytes.NewReader(jsonBody))
|
||||
if err != nil {
|
||||
return "", err
|
||||
// If something goes wrong it really does not matter
|
||||
return "", nil
|
||||
}
|
||||
defer func() {
|
||||
io.Copy(ioutil.Discard, resp.Body)
|
||||
@ -211,7 +212,8 @@ func (c *rollbarClient) send(item map[string]interface{}) (uuid string, err erro
|
||||
}()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return "", fmt.Errorf("Rollbar returned %s", resp.Status)
|
||||
// If something goes wrong it really does not matter
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// Extract UUID from JSON response
|
0
vendor/github.com/stvp/roll/stack.go → vendor/github.com/jesseduffield/roll/stack.go
generated
vendored
0
vendor/github.com/stvp/roll/stack.go → vendor/github.com/jesseduffield/roll/stack.go
generated
vendored
0
vendor/github.com/heroku/rollrus/LICENSE → vendor/github.com/jesseduffield/rollrus/LICENSE
generated
vendored
0
vendor/github.com/heroku/rollrus/LICENSE → vendor/github.com/jesseduffield/rollrus/LICENSE
generated
vendored
20
vendor/github.com/heroku/rollrus/rollrus.go → vendor/github.com/jesseduffield/rollrus/rollrus.go
generated
vendored
20
vendor/github.com/heroku/rollrus/rollrus.go → vendor/github.com/jesseduffield/rollrus/rollrus.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Package rollrus combines github.com/stvp/roll with github.com/sirupsen/logrus
|
||||
// Package rollrus combines github.com/jesseduffield/roll with github.com/sirupsen/logrus
|
||||
// via logrus.Hook mechanism, so that whenever logrus' logger.Error/f(),
|
||||
// logger.Fatal/f() or logger.Panic/f() are used the messages are
|
||||
// intercepted and sent to rollbar.
|
||||
@ -22,9 +22,9 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/jesseduffield/roll"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/stvp/roll"
|
||||
)
|
||||
|
||||
var defaultTriggerLevels = []logrus.Level{
|
||||
@ -37,7 +37,7 @@ var defaultTriggerLevels = []logrus.Level{
|
||||
type Hook struct {
|
||||
roll.Client
|
||||
triggers []logrus.Level
|
||||
ignoredErrors map[error]struct{}
|
||||
ignoredErrors []error
|
||||
ignoreErrorFunc func(error) bool
|
||||
ignoreFunc func(error, map[string]string) bool
|
||||
|
||||
@ -78,12 +78,10 @@ func WithMinLevel(level logrus.Level) OptionFunc {
|
||||
}
|
||||
|
||||
// WithIgnoredErrors is an OptionFunc that whitelists certain errors to prevent
|
||||
// them from firing.
|
||||
// them from firing. See https://golang.org/ref/spec#Comparison_operators
|
||||
func WithIgnoredErrors(errors ...error) OptionFunc {
|
||||
return func(h *Hook) {
|
||||
for _, e := range errors {
|
||||
h.ignoredErrors[e] = struct{}{}
|
||||
}
|
||||
h.ignoredErrors = append(h.ignoredErrors, errors...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +118,7 @@ func NewHookForLevels(token string, env string, levels []logrus.Level) *Hook {
|
||||
return &Hook{
|
||||
Client: roll.New(token, env),
|
||||
triggers: levels,
|
||||
ignoredErrors: make(map[error]struct{}),
|
||||
ignoredErrors: make([]error, 0),
|
||||
ignoreErrorFunc: func(error) bool { return false },
|
||||
ignoreFunc: func(error, map[string]string) bool { return false },
|
||||
}
|
||||
@ -179,8 +177,10 @@ func (r *Hook) Levels() []logrus.Level {
|
||||
// returned by Levels().
|
||||
func (r *Hook) Fire(entry *logrus.Entry) error {
|
||||
trace, cause := extractError(entry)
|
||||
if _, ok := r.ignoredErrors[cause]; ok {
|
||||
return nil
|
||||
for _, ie := range r.ignoredErrors {
|
||||
if ie == cause {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
if r.ignoreErrorFunc(cause) {
|
Reference in New Issue
Block a user