mirror of
https://github.com/Graylog2/graylog-project-cli.git
synced 2026-03-13 08:02:57 +08:00
This makes it easier to spot any errors when updating the project repositories by displaying them at the end of the command.
26 lines
428 B
Go
26 lines
428 B
Go
package logger
|
|
|
|
import "fmt"
|
|
|
|
func NewLoggableError(err error, title string, messages []string) *LoggableError {
|
|
return &LoggableError{
|
|
title: title,
|
|
Messages: messages,
|
|
err: err,
|
|
}
|
|
}
|
|
|
|
type LoggableError struct {
|
|
title string
|
|
Messages []string
|
|
err error
|
|
}
|
|
|
|
func (l LoggableError) Cause() error {
|
|
return l.err
|
|
}
|
|
|
|
func (l LoggableError) Error() string {
|
|
return fmt.Sprintf("%s: %s", l.title, l.err)
|
|
}
|