소스 검색

Rearrange status checks in CreatePost

pull/9/head
Matt Baer 5 년 전
부모
커밋
5d3a329a7a
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. +5
    -5
      post.go

+ 5
- 5
post.go 파일 보기

@@ -124,13 +124,13 @@ func (c *Client) CreatePost(sp *PostParams) (*Post, error) {
}

status := env.Code
if status == http.StatusCreated {
return p, nil
} else if status == http.StatusBadRequest {
return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
} else {
if status != http.StatusCreated {
if status == http.StatusBadRequest {
return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
}
return nil, fmt.Errorf("Problem creating post: %d. %v\n", status, err)
}
return p, nil
}

// UpdatePost updates a published post with the given PostParams. See


불러오는 중...
취소
저장