diff options
Diffstat (limited to 'reader/subscription')
-rw-r--r-- | reader/subscription/finder.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/reader/subscription/finder.go b/reader/subscription/finder.go index 6b45cfb..57fbd11 100644 --- a/reader/subscription/finder.go +++ b/reader/subscription/finder.go @@ -24,6 +24,8 @@ var ( errConnectionFailure = "Unable to open this link: %v" errUnreadableDoc = "Unable to analyze this page: %v" errEmptyBody = "This web page is empty" + errNotAuthorized = "You are not authorized to access this resource (invalid username/password)" + errServerFailure = "Unable to fetch this resource (Status Code = %d)" ) // FindSubscriptions downloads and try to find one or more subscriptions from an URL. @@ -40,6 +42,14 @@ func FindSubscriptions(websiteURL, username, password string) (Subscriptions, er return nil, errors.NewLocalizedError(errConnectionFailure, err) } + if response.IsNotAuthorized() { + return nil, errors.NewLocalizedError(errNotAuthorized) + } + + if response.HasServerFailure() { + return nil, errors.NewLocalizedError(errServerFailure, response.StatusCode) + } + // Content-Length = -1 when no Content-Length header is sent if response.ContentLength == 0 { return nil, errors.NewLocalizedError(errEmptyBody) |