This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
go-discogs/errors.go

27 lines
653 B
Go
Raw Normal View History

2016-03-09 15:14:42 +00:00
package discogs
import (
"fmt"
2018-03-24 13:14:54 +00:00
"strings"
2016-03-09 15:14:42 +00:00
)
2018-03-24 13:14:54 +00:00
// Error represents a Discogs API error
type Error struct {
Message string
2016-03-09 15:14:42 +00:00
}
2018-03-24 13:14:54 +00:00
func (e *Error) Error() string {
2018-04-10 12:39:54 +00:00
return fmt.Sprintf("discogs error: %s", strings.ToLower(e.Message))
2016-03-09 15:14:42 +00:00
}
2018-03-24 13:14:54 +00:00
// APIErrors
var (
ErrCurrencyNotSupported = &Error{"currency does not supported"}
ErrInvalidReleaseID = &Error{"invalid release id"}
ErrInvalidSortKey = &Error{"invalid sort key"}
ErrInvalidUsername = &Error{"invalid username"}
2021-12-09 11:38:29 +00:00
ErrTooManyRequests = &Error{"too many requests"}
ErrUnauthorized = &Error{"authentication required"}
ErrUserAgentInvalid = &Error{"invalid user-agent"}
2018-03-24 13:14:54 +00:00
)