Merge pull request #15 from drone-plugins/exitmessagef

Add errors.ExitMessagef
This commit is contained in:
Thomas Boerger 2020-06-01 22:37:37 +02:00 committed by GitHub
commit 29db00764f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ func (e ExitError) Fields() logrus.Fields {
return e.fields
}
// ExitMessage initiales a new ExitCoder implementation.
// ExitMessage initializes a new ExitCoder implementation.
func ExitMessage(message interface{}) ExitError {
return ExitError{
message: message,
@ -44,7 +44,15 @@ func ExitMessage(message interface{}) ExitError {
}
}
// WithFields initiales a new ExitCoder implementation.
// ExitMessagef initializes a new ExitCoder implementation.
func ExitMessagef(format string, a ...interface{}) ExitError {
return ExitError{
message: fmt.Errorf(format, a...),
code: 1,
}
}
// WithFields initializes a new ExitCoder implementation.
func WithFields(message interface{}, fields logrus.Fields) ExitError {
return ExitError{
message: message,