mirror of
https://github.com/writeas/go-writeas.git
synced 2025-07-28 00:39:52 +00:00
Merge pull request #6 from ProfessorTom/fix_error_format_verbs
use correct verb for error formatting
This commit is contained in:
commit
159315bfd1
2
auth.go
2
auth.go
@ -39,7 +39,7 @@ func (c *Client) LogIn(username, pass string) (*AuthUser, error) {
|
||||
} else if status == http.StatusTooManyRequests {
|
||||
return nil, fmt.Errorf("Stop repeatedly trying to log in.")
|
||||
}
|
||||
return nil, fmt.Errorf("Problem authenticating: %s. %v\n", status, err)
|
||||
return nil, fmt.Errorf("Problem authenticating: %d. %v\n", status, err)
|
||||
}
|
||||
|
||||
func (c *Client) isNotLoggedIn(code int) bool {
|
||||
|
@ -57,7 +57,7 @@ func (c *Client) CreateCollection(sp *CollectionParams) (*Collection, error) {
|
||||
} else if status == http.StatusPreconditionFailed {
|
||||
return nil, fmt.Errorf("Reached max collection quota.")
|
||||
}
|
||||
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
|
||||
return nil, fmt.Errorf("Problem getting post: %d. %v\n", status, err)
|
||||
}
|
||||
|
||||
// GetCollection retrieves a collection, returning the Collection and any error
|
||||
@ -81,7 +81,7 @@ func (c *Client) GetCollection(alias string) (*Collection, error) {
|
||||
} else if status == http.StatusNotFound {
|
||||
return nil, fmt.Errorf("Collection not found.")
|
||||
} else {
|
||||
return nil, fmt.Errorf("Problem getting collection: %s. %v\n", status, err)
|
||||
return nil, fmt.Errorf("Problem getting collection: %d. %v\n", status, err)
|
||||
}
|
||||
return coll, nil
|
||||
}
|
||||
@ -107,7 +107,7 @@ func (c *Client) GetCollectionPosts(alias string) (*[]Post, error) {
|
||||
} else if status == http.StatusNotFound {
|
||||
return nil, fmt.Errorf("Collection not found.")
|
||||
} else {
|
||||
return nil, fmt.Errorf("Problem getting collection: %s. %v\n", status, err)
|
||||
return nil, fmt.Errorf("Problem getting collection: %d. %v\n", status, err)
|
||||
}
|
||||
return coll.Posts, nil
|
||||
}
|
||||
|
10
post.go
10
post.go
@ -86,7 +86,7 @@ func (c *Client) GetPost(id string) (*Post, error) {
|
||||
} else if status == http.StatusGone {
|
||||
return nil, fmt.Errorf("Post unpublished.")
|
||||
}
|
||||
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
|
||||
return nil, fmt.Errorf("Problem getting post: %d. %v\n", status, err)
|
||||
}
|
||||
|
||||
// CreatePost publishes a new post, returning a user-friendly error if one comes
|
||||
@ -113,7 +113,7 @@ func (c *Client) CreatePost(sp *PostParams) (*Post, error) {
|
||||
} else if status == http.StatusBadRequest {
|
||||
return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
|
||||
} else {
|
||||
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
|
||||
return nil, fmt.Errorf("Problem getting post: %d. %v\n", status, err)
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
@ -140,7 +140,7 @@ func (c *Client) UpdatePost(sp *PostParams) (*Post, error) {
|
||||
} else if status == http.StatusBadRequest {
|
||||
return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
|
||||
}
|
||||
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
|
||||
return nil, fmt.Errorf("Problem getting post: %d. %v\n", status, err)
|
||||
}
|
||||
|
||||
// DeletePost permanently deletes a published post. See
|
||||
@ -161,7 +161,7 @@ func (c *Client) DeletePost(sp *PostParams) error {
|
||||
} else if status == http.StatusBadRequest {
|
||||
return fmt.Errorf("Bad request: %s", env.ErrorMessage)
|
||||
}
|
||||
return fmt.Errorf("Problem getting post: %s. %v\n", status, err)
|
||||
return fmt.Errorf("Problem getting post: %d. %v\n", status, err)
|
||||
}
|
||||
|
||||
// ClaimPosts associates anonymous posts with a user / account.
|
||||
@ -186,7 +186,7 @@ func (c *Client) ClaimPosts(sp *[]OwnedPostParams) (*[]ClaimPostResult, error) {
|
||||
} else if status == http.StatusBadRequest {
|
||||
return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
|
||||
} else {
|
||||
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
|
||||
return nil, fmt.Errorf("Problem getting post: %d. %v\n", status, err)
|
||||
}
|
||||
// TODO: does this also happen with moving posts?
|
||||
return p, nil
|
||||
|
Loading…
Reference in New Issue
Block a user