@@ 24,11 24,18 @@ type Client struct {
}
type Settings struct {
- Endpoint, Username, Password, PasswordCmd, Calendar string
+ Endpoint string
+ Username string
+ Password string
+ PasswordCmd string
+ Calendar string
}
func NewClient(cs Settings) (*Client, error) {
password, err := getPassword(cs.Password, cs.PasswordCmd)
+ if err != nil {
+ return nil, fmt.Errorf("getting password: %w", err)
+ }
httpClient := webdav.HTTPClientWithBasicAuth(nil, cs.Username, password)
cd, err := caldav.NewClient(httpClient, cs.Endpoint)
if err != nil {
@@ 40,7 47,7 @@ func NewClient(cs Settings) (*Client, error) {
calendar: cs.Calendar,
}
if err := c.getCalendarPath(); err != nil {
- return nil, err
+ return nil, fmt.Errorf("getting calendar path: %w", err)
}
return c, nil
}