mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Add specific 404 and 401 error messages
This commit is contained in:
parent
a40f592aab
commit
9c0f882ba0
9 changed files with 54 additions and 19 deletions
|
@ -21,12 +21,13 @@ import (
|
|||
|
||||
var (
|
||||
errRequestFailed = "Unable to execute request: %v"
|
||||
errServerFailure = "Unable to fetch feed (statusCode=%d)"
|
||||
errServerFailure = "Unable to fetch feed (Status Code = %d)"
|
||||
errDuplicate = "This feed already exists (%s)"
|
||||
errNotFound = "Feed %d not found"
|
||||
errEncoding = "Unable to normalize encoding: %q"
|
||||
errCategoryNotFound = "Category not found for this user"
|
||||
errEmptyFeed = "This feed is empty"
|
||||
errResourceNotFound = "Resource not found (404), this feed doesn't exists anymore, check the feed URL"
|
||||
)
|
||||
|
||||
// Handler contains all the logic to create and refresh feeds.
|
||||
|
@ -152,6 +153,14 @@ func (h *Handler) RefreshFeed(userID, feedID int64) error {
|
|||
|
||||
originalFeed.CheckedAt = time.Now()
|
||||
|
||||
if response.IsNotFound() {
|
||||
err := errors.NewLocalizedError(errResourceNotFound)
|
||||
originalFeed.ParsingErrorCount++
|
||||
originalFeed.ParsingErrorMsg = err.Localize(currentLanguage)
|
||||
h.store.UpdateFeed(originalFeed)
|
||||
return err
|
||||
}
|
||||
|
||||
if response.HasServerFailure() {
|
||||
err := errors.NewLocalizedError(errServerFailure, response.StatusCode)
|
||||
originalFeed.ParsingErrorCount++
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue