apollo-backend/internal/reddit/errors.go

29 lines
585 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")
2021-08-14 17:42:28 +00:00
)