Add errors.ExitMessagef

This commit is contained in:
Don 2020-06-01 12:40:28 -07:00
parent d945fc6a48
commit e4701dca7e

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,