1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Fix error handling and logging issue after refactoring

This commit is contained in:
Frédéric Guillot 2023-11-01 18:28:24 +00:00
parent ef53bf14ae
commit 500c60b807
21 changed files with 24 additions and 24 deletions

View file

@ -78,8 +78,8 @@ func (r *ResponseHandler) ReadBody(maxBodySize int64) ([]byte, *locale.Localized
buffer, err := io.ReadAll(limitedReader)
if err != nil && err != io.EOF {
if err == io.ErrUnexpectedEOF {
return nil, locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: response body too large: %w", err), "error.http_response_too_large")
if err, ok := err.(*http.MaxBytesError); ok {
return nil, locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: response body too large: %d bytes", err.Limit), "error.http_response_too_large")
}
return nil, locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: unable to read response body: %w", err), "error.http_body_read", err)