carddav: populate AddressBook.{Name,MaxResourceSize} in client

This commit is contained in:
Simon Ser
2020-01-19 15:29:51 +01:00
parent c4718a3a49
commit 6e0ea58de1
4 changed files with 34 additions and 9 deletions

View File

@@ -50,7 +50,7 @@ func (s *Status) Err() error {
// TODO: handle 2xx, 3xx
if s.Code != http.StatusOK {
return fmt.Errorf("webdav: HTTP error: %v %v", s.Code, s.Text)
return &HTTPError{Code: s.Code}
}
return nil
}

View File

@@ -24,6 +24,10 @@ func HTTPErrorFromError(err error) *HTTPError {
}
}
func IsNotFound(err error) bool {
return HTTPErrorFromError(err).Code == http.StatusNotFound
}
func HTTPErrorf(code int, format string, a ...interface{}) *HTTPError {
return &HTTPError{code, fmt.Errorf(format, a...)}
}