Check for nil error in ErrConflict (#14636)

We check if the err is nil or not before calling the Error() method.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2020-05-25 18:38:11 +05:30
коммит произвёл GitHub
родитель 235c53189e
Коммит 25fb1296af

Просмотреть файл

@@ -61,7 +61,11 @@ func NewErrConflict(resource string, err error, meta string) *ErrConflict {
}
func (e *ErrConflict) Error() string {
return e.Resource + "exists " + e.meta + " " + e.err.Error()
msg := e.Resource + "exists " + e.meta
if e.err != nil {
msg += " " + e.err.Error()
}
return msg
}
func (e *ErrConflict) Unwrap() error {