2018-03-08 18:46:15 -03:00
|
|
|
// Package pipeline provides generic erros for pipes to use.
|
2016-12-30 09:27:35 -02:00
|
|
|
package pipeline
|
|
|
|
|
2018-02-24 17:59:08 -03:00
|
|
|
// ErrSnapshotEnabled happens when goreleaser is running in snapshot mode.
|
|
|
|
// It usually means that publishing and maybe some validations were skipped.
|
|
|
|
var ErrSnapshotEnabled = Skip("disabled during snapshot mode")
|
2018-01-10 19:22:37 -02:00
|
|
|
|
2018-03-01 01:12:58 -03:00
|
|
|
// ErrSkipPublishEnabled happens if --skip-publish is set.
|
|
|
|
// It means that the part of a Piper that publishes its artifacts was not run.
|
|
|
|
var ErrSkipPublishEnabled = Skip("publishing is disabled")
|
|
|
|
|
2018-05-24 10:50:14 +02:00
|
|
|
// ErrSkipSignEnabled happens if --skip-sign is set.
|
|
|
|
// It means that the part of a Piper that signs some things was not run.
|
|
|
|
var ErrSkipSignEnabled = Skip("artifact signing is disabled")
|
|
|
|
|
2018-03-08 08:42:33 -03:00
|
|
|
// ErrSkipValidateEnabled happens if --skip-validate is set.
|
|
|
|
// It means that the part of a Piper that validates some things was not run.
|
|
|
|
var ErrSkipValidateEnabled = Skip("validation is disabled")
|
|
|
|
|
2017-09-12 00:22:02 -03:00
|
|
|
// IsSkip returns true if the error is an ErrSkip
|
2017-09-11 23:31:00 -03:00
|
|
|
func IsSkip(err error) bool {
|
|
|
|
_, ok := err.(ErrSkip)
|
|
|
|
return ok
|
|
|
|
}
|
|
|
|
|
2017-08-20 16:35:46 -03:00
|
|
|
// ErrSkip occurs when a pipe is skipped for some reason
|
|
|
|
type ErrSkip struct {
|
|
|
|
reason string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Error implements the error interface. returns the reason the pipe was skipped
|
|
|
|
func (e ErrSkip) Error() string {
|
|
|
|
return e.reason
|
|
|
|
}
|
|
|
|
|
|
|
|
// Skip skips this pipe with the given reason
|
|
|
|
func Skip(reason string) ErrSkip {
|
2018-06-19 15:53:14 -03:00
|
|
|
return ErrSkip{reason: reason}
|
2017-08-20 16:35:46 -03:00
|
|
|
}
|