-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FXIOS-11063 Improve how we handle failing network requests to retrieve favicon URL and images #24282
base: main
Are you sure you want to change the base?
Conversation
@@ -38,6 +38,12 @@ struct DefaultFaviconURLHandler: FaviconURLHandler { | |||
await urlCache.cacheURL(cacheKey: model.cacheKey, faviconURL: url) | |||
return url | |||
} catch { | |||
let isServerError = ServerErrorHelper.extractServerError(error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have unit tests for this? You might have to remove the ServerErrorHelper
being static to do so
@@ -117,7 +117,13 @@ class DefaultImageHandler: ImageHandler { | |||
await imageCache.cacheImage(image: image, cacheKey: imageModel.cacheKey, type: imageModel.imageType) | |||
return image | |||
} catch { | |||
return await fallbackToLetterFavicon(imageModel: imageModel) | |||
let isServerError = ServerErrorHelper.extractServerError(error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests for this as well and the fallbackToLetterFavicon
code would be awesome 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉 great work just some minor things. Also as @lmarceau would be nice to have test coverage for the changes
let isServerError = ServerErrorHelper.extractServerError(error) | ||
|
||
if isServerError { | ||
return await fallbackToLetterFavicon(imageModel: imageModel, isServerError: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we pass directly isServerError to the method ?
return await fallbackToLetterFavicon(imageModel: imageModel, isServerError: isServerError)
📜 Tickets
Jira ticket
Github issue
💡 Description
📝 Checklist
You have to check all boxes before merging
@Mergifyio backport release/v120
)