Skip to content

Commit

Permalink
chore: remove unnecessary error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nakrovati committed Mar 18, 2024
1 parent baa35c9 commit dd20ca5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
14 changes: 2 additions & 12 deletions pkg/providers/fapello/fapello.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@ func buildURL(userName string, recentId int) (string, error) {
secondSymbol := userName[1]
photoCountGroup := roundUp(recentId)

url, err := url.JoinPath(baseURL, "content", string(firstSymbol), string(secondSymbol), userName, strconv.Itoa(photoCountGroup))
if err != nil {
return "", err
}
return url, nil
return url.JoinPath(baseURL, "content", string(firstSymbol), string(secondSymbol), userName, strconv.Itoa(photoCountGroup))
}

func parsePhotoID(url string) (int, error) {
Expand All @@ -141,13 +137,7 @@ func parsePhotoID(url string) (int, error) {
return 0, fmt.Errorf("invalid url: %s", url)
}

id, err := strconv.Atoi(matches[1])
if err != nil {
return 0, err
}

return id, nil

return strconv.Atoi(matches[1])
}

func roundUp(num int) int {
Expand Down
13 changes: 2 additions & 11 deletions pkg/providers/fapodrop/fapodrop.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ func buildURL(name string) (string, error) {
firstSymbol := name[0]
secondSymbol := name[1]

url, err := url.JoinPath(baseURL, "images", string(firstSymbol), string(secondSymbol), name, "1", "photo")
if err != nil {
return "", err
}
return url, nil
return url.JoinPath(baseURL, "images", string(firstSymbol), string(secondSymbol), name, "1", "photo")
}

func getRecentPhotoID(name string) (int, error) {
Expand Down Expand Up @@ -138,10 +134,5 @@ func parsePhotoID(url string) (int, error) {
}

numStr := match[1:] // Take out the first "/"
num, err := strconv.Atoi(numStr)
if err != nil {
return 0, err
}

return num, nil
return strconv.Atoi(numStr)
}

0 comments on commit dd20ca5

Please sign in to comment.