Added missing comments

This commit is contained in:
2018-07-30 10:18:54 +02:00
parent 17ca4cbf14
commit 62ed77f142
6 changed files with 20 additions and 8 deletions

View File

@ -5,11 +5,13 @@ import (
"strings"
)
//APIError contains the returned error code and message from the Nextcloud's API
type APIError struct {
Code int
Message string
}
//ErrorFromMeta return a types.APIError from the Response's types.Meta
func ErrorFromMeta(meta Meta) *APIError {
return &APIError{
meta.Statuscode,
@ -17,15 +19,18 @@ func ErrorFromMeta(meta Meta) *APIError {
}
}
//Error return the types.APIError string
func (e *APIError) Error() string {
return fmt.Sprintf("%d : %s", e.Code, e.Message)
}
//UpdateError contains the user's field and corresponding error
type UpdateError struct {
Field string
Error error
}
//UpdateError contains the errors resulting from a UserUpdate or a UserCreateFull call
type UserUpdateError struct {
Errors map[string]error
}
@ -38,6 +43,7 @@ func (e *UserUpdateError) Error() string {
return strings.Join(errors, ",")
}
//NewUpdateError returns an UpdateError based on an UpdateError channel
func NewUpdateError(errors chan UpdateError) *UserUpdateError {
empty := true
var ue UserUpdateError