apollo-backend/internal/reddit/errors.go

35 lines
858 B
Go
Raw Permalink Normal View History

2021-08-14 17:42:28 +00:00
package reddit
import (
"errors"
"fmt"
)
type ServerError struct {
2022-05-23 21:26:40 +00:00
Body string
2021-08-14 17:42:28 +00:00
StatusCode int
}
func (se ServerError) Error() string {
2022-05-23 21:26:40 +00:00
return fmt.Sprintf("error from reddit: %d (%s)", se.StatusCode, se.Body)
2021-08-14 17:42:28 +00:00
}
var (
// ErrOauthRevoked .
ErrOauthRevoked = errors.New("oauth revoked")
2021-08-14 18:07:19 +00:00
// ErrTimeout .
ErrTimeout = errors.New("timeout")
2022-03-12 17:50:05 +00:00
// ErrRateLimited .
ErrRateLimited = errors.New("rate limited")
// ErrRequiresRedditId .
ErrRequiresRedditId = errors.New("requires reddit id")
2022-05-23 21:26:40 +00:00
// ErrInvalidBasicAuth .
ErrInvalidBasicAuth = errors.New("invalid basic auth")
// ErrSubredditIsPrivate .
ErrSubredditIsPrivate = errors.New("subreddit is private")
// ErrSubredditIsQuarantined .
ErrSubredditIsQuarantined = errors.New("subreddit is quarantined")
// ErrSubredditNotFound .
ErrSubredditNotFound = errors.New("subreddit not found")
2021-08-14 17:42:28 +00:00
)