From 63f413f477f3e137882748c4425d5bec92b92c16 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 10 May 2018 16:23:10 +0100 Subject: [PATCH] webdav: show all available information when printing errors --- backend/webdav/api/types.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.go index 284b145fb..b92cc97b9 100644 --- a/backend/webdav/api/types.go +++ b/backend/webdav/api/types.go @@ -5,6 +5,7 @@ import ( "encoding/xml" "regexp" "strconv" + "strings" "time" ) @@ -109,16 +110,20 @@ type Error struct { // Error returns a string for the error and statistifes the error interface func (e *Error) Error() string { + var out []string if e.Message != "" { - return e.Message + out = append(out, e.Message) } if e.Exception != "" { - return e.Exception + out = append(out, e.Exception) } if e.Status != "" { - return e.Status + out = append(out, e.Status) } - return "Webdav Error" + if len(out) == 0 { + return "Webdav Error" + } + return strings.Join(out, ": ") } // Time represents represents date and time information for the