mirror of
https://github.com/1f349/go-webdav.git
synced 2025-01-02 13:36:29 +00:00
Add error returning for missing error output paths
Co-Authored-By: Captain ALM <captainalm@captainalm.com>
This commit is contained in:
parent
9094f8327e
commit
9dd12e301a
@ -1,6 +1,7 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -353,7 +354,7 @@ type Time time.Time
|
|||||||
func (t *Time) UnmarshalText(b []byte) error {
|
func (t *Time) UnmarshalText(b []byte) error {
|
||||||
tt, err := http.ParseTime(string(b))
|
tt, err := http.ParseTime(string(b))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.New(err.Error() + " : time_data : " + base64.StdEncoding.EncodeToString(b))
|
||||||
}
|
}
|
||||||
*t = Time(tt)
|
*t = Time(tt)
|
||||||
return nil
|
return nil
|
||||||
|
@ -187,9 +187,8 @@ func NewPropFindResponse(path string, propfind *PropFind, props map[xml.Name]Pro
|
|||||||
|
|
||||||
code := http.StatusOK
|
code := http.StatusOK
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: don't throw away error message here
|
|
||||||
code = HTTPErrorFromError(err).Code
|
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 {
|
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]
|
f, ok := props[xmlName]
|
||||||
if ok {
|
if ok {
|
||||||
if v, err := f(&raw); err != nil {
|
if v, err := f(&raw); err != nil {
|
||||||
// TODO: don't throw away error message here
|
|
||||||
code = HTTPErrorFromError(err).Code
|
code = HTTPErrorFromError(err).Code
|
||||||
|
val = NewRawXMLElement(xmlName, []xml.Attr{{Name: xml.Name{Space: "ERR", Local: "Error"}, Value: err.Error()}}, nil)
|
||||||
} else {
|
} else {
|
||||||
code = http.StatusOK
|
code = http.StatusOK
|
||||||
val = v
|
val = v
|
||||||
|
Loading…
Reference in New Issue
Block a user