mirror of
https://github.com/miniflux/v2.git
synced 2025-08-31 18:31:01 +00:00
Ensure that LocalizedError are returned by parsers
This commit is contained in:
parent
557cf9c21d
commit
0e6717b7c8
15 changed files with 71 additions and 30 deletions
|
@ -6,9 +6,10 @@ package json
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/miniflux/miniflux2/model"
|
||||
"io"
|
||||
|
||||
"github.com/miniflux/miniflux2/errors"
|
||||
"github.com/miniflux/miniflux2/model"
|
||||
)
|
||||
|
||||
// Parse returns a normalized feed struct.
|
||||
|
@ -16,7 +17,7 @@ func Parse(data io.Reader) (*model.Feed, error) {
|
|||
jsonFeed := new(JsonFeed)
|
||||
decoder := json.NewDecoder(data)
|
||||
if err := decoder.Decode(&jsonFeed); err != nil {
|
||||
return nil, fmt.Errorf("Unable to parse JSON Feed: %v", err)
|
||||
return nil, errors.NewLocalizedError("Unable to parse JSON Feed: %v", err)
|
||||
}
|
||||
|
||||
return jsonFeed.Transform(), nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue