mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
60e54a1368
* refactor: added middleware for action logs/error handling * refactor: moved custom changelog load from main.go * fix/refactor: CLI improvements * test: do not pollute ./dist
24 lines
483 B
Go
24 lines
483 B
Go
package middleware
|
|
|
|
import (
|
|
"github.com/apex/log"
|
|
"github.com/goreleaser/goreleaser/internal/pipe"
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
)
|
|
|
|
// ErrHandler handles an action error, ignoring and logging pipe skipped
|
|
// errors.
|
|
func ErrHandler(action Action) Action {
|
|
return func(ctx *context.Context) error {
|
|
var err = action(ctx)
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
if pipe.IsSkip(err) {
|
|
log.WithError(err).Warn("pipe skipped")
|
|
return nil
|
|
}
|
|
return err
|
|
}
|
|
}
|