Fix error naming

This commit is contained in:
Daniel 2024-04-17 17:01:37 +02:00
parent a457ac4245
commit cdabffafcd
3 changed files with 6 additions and 6 deletions
service/profile

View file

@ -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

View file

@ -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) {
@ -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.
@ -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.

View file

@ -518,7 +518,7 @@ func (profile *Profile) updateMetadataFromSystem(ctx context.Context, md Matchin
switch {
case err == nil:
// Continue
case errors.Is(err, binmeta.IconIgnored):
case errors.Is(err, binmeta.ErrIconIgnored):
newIcon = nil
// Continue
default: