Skip to content

Commit

Permalink
Fix error naming
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Apr 17, 2024
1 parent a457ac4 commit d8fc9c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion service/profile/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func handleGetProfileIcon(ar *api.Request) (data []byte, err error) {
switch {
case err == nil:
// Continue
case errors.Is(err, binmeta.IconIgnored):
case errors.Is(err, binmeta.ErrIconIgnored):
return nil, api.ErrorWithStatus(err, http.StatusNotFound)
default:
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions service/profile/binmeta/icons.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
// Must not be changed once set.
var ProfileIconStoragePath = ""

// IconIgnored is returned when the icon should be ignored.
var IconIgnored = errors.New("icon is ignored")
// ErrIconIgnored is returned when the icon should be ignored.
var ErrIconIgnored = errors.New("icon is ignored")

// GetProfileIcon returns the profile icon with the given ID and extension.
func GetProfileIcon(name string) (data []byte, err error) {
Expand All @@ -31,7 +31,7 @@ func GetProfileIcon(name string) (data []byte, err error) {

// Check if icon should be ignored.
if IgnoreIcon(name) {
return nil, IconIgnored
return nil, ErrIconIgnored
}

// Build storage path.
Expand Down Expand Up @@ -69,7 +69,7 @@ func UpdateProfileIcon(data []byte, ext string) (filename string, err error) {

// Check if icon should be ignored.
if IgnoreIcon(sum) {
return "", IconIgnored
return "", ErrIconIgnored
}

// Check ext.
Expand Down

0 comments on commit d8fc9c9

Please sign in to comment.