Skip to content

Commit

Permalink
Merge pull request #83 from Henry-Sarabia/iss-82
Browse files Browse the repository at this point in the history
Unexport serverError
  • Loading branch information
Henry Sarabia authored Feb 13, 2020
2 parents 4b65495 + ccbe698 commit bafd30f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kanka.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (c *Client) send(req *http.Request, result interface{}) error {
defer resp.Body.Close()

if !isSuccess(resp.StatusCode) {
return &ServerError{code: resp.StatusCode, status: resp.Status, temporary: isTemporary(resp.StatusCode)}
return &serverError{code: resp.StatusCode, status: resp.Status, temporary: isTemporary(resp.StatusCode)}
}

b, err := ioutil.ReadAll(resp.Body)
Expand Down Expand Up @@ -209,7 +209,7 @@ func (c *Client) delete(end endpoint) error {
defer resp.Body.Close()

if !isSuccess(resp.StatusCode) {
return &ServerError{code: resp.StatusCode, status: resp.Status, temporary: isTemporary(resp.StatusCode)}
return &serverError{code: resp.StatusCode, status: resp.Status, temporary: isTemporary(resp.StatusCode)}
}

return nil
Expand Down
8 changes: 4 additions & 4 deletions servererror.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import (
"net/http"
)

// ServerError represents an error originating from another server.
type ServerError struct {
// serverError represents an error originating from another server.
type serverError struct {
code int
status string
temporary bool
}

// Error returns the status message of an error.
func (e *ServerError) Error() string {
func (e *serverError) Error() string {
return fmt.Sprintf("server responded with status '%s'", e.status)
}

// Temporary returns true if the error is temporary.
func (e *ServerError) Temporary() bool {
func (e *serverError) Temporary() bool {
return e.temporary
}

Expand Down

0 comments on commit bafd30f

Please sign in to comment.