aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader/subscription
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-06-30 12:42:12 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-06-30 12:42:12 -0700
commit9c0f882ba0c7f8635ff7ab8007d134f7aefd69f2 (patch)
tree4056c457596aa471adcdf32cc712ca51d83eae02 /reader/subscription
parenta40f592aab89cc6e5c8f2a9be8ed912f8204f070 (diff)
Add specific 404 and 401 error messages
Diffstat (limited to 'reader/subscription')
-rw-r--r--reader/subscription/finder.go10
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)