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>
Этот коммит содержится в:
коммит произвёл
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 {
|
||||
|
||||
Ссылка в новой задаче
Block a user