Add error returning for missing error output paths

Co-Authored-By: Captain ALM <captainalm@captainalm.com>
This commit is contained in:
Melon 2024-09-27 00:36:52 +01:00
parent 9094f8327e
commit 9dd12e301a
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package internal
import (
"encoding/base64"
"encoding/xml"
"errors"
"fmt"
@ -353,7 +354,7 @@ type Time time.Time
func (t *Time) UnmarshalText(b []byte) error {
tt, err := http.ParseTime(string(b))
if err != nil {
return err
return errors.New(err.Error() + " : time_data : " + base64.StdEncoding.EncodeToString(b))
}
*t = Time(tt)
return nil

View File

@ -187,9 +187,8 @@ func NewPropFindResponse(path string, propfind *PropFind, props map[xml.Name]Pro
code := http.StatusOK
if err != nil {
// TODO: don't throw away error message here
code = HTTPErrorFromError(err).Code
val = emptyVal
val = NewRawXMLElement(xmlName, []xml.Attr{{Name: xml.Name{Space: "ERR", Local: "Error"}, Value: err.Error()}}, nil)
}
if err := resp.EncodeProp(code, val); err != nil {
@ -210,8 +209,8 @@ func NewPropFindResponse(path string, propfind *PropFind, props map[xml.Name]Pro
f, ok := props[xmlName]
if ok {
if v, err := f(&raw); err != nil {
// TODO: don't throw away error message here
code = HTTPErrorFromError(err).Code
val = NewRawXMLElement(xmlName, []xml.Attr{{Name: xml.Name{Space: "ERR", Local: "Error"}, Value: err.Error()}}, nil)
} else {
code = http.StatusOK
val = v