-
Notifications
You must be signed in to change notification settings - Fork 830
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
Remove error logging caused by offline check #2777
Conversation
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.
Thanks, Phil! These code changes look fine to me.
Just to double-check before merging, with those changes in place, is it fine to keep the following as-is? That actually makes me less concerned about this being a "breaking" change, if so.
workbox/packages/workbox-strategies/src/Strategy.ts
Lines 240 to 242 in 2c8bfe7
if (error) { | |
throw error; | |
} |
Yep, the error doesn't get that far with these changes. |
R: @jeffposnick @tropicadri
Fixes #2749
This PR removes confusing errors logged to the console in Chrome when doing the offline check. It does this by:
StrategyHandler#fetch()
method's console level to LOG from ERROR when a network request fails. Since the strategy will also error if no response is returned (e.g. nothing is found in the cache), this message should be considered more informative than actionable.StrategyHandler#fetch()
andStrategyHandler#cacheMatch()
methods to not callthis.waitUntil()
on the response. CallingwaitUntil()
in these situations is not necessary because SW implementations automatically wait on afetch
event'srespondWith()
promise. Furthermore, doing so in theStrategyHandler
instance was causing response errors to be reported twice in some cases (leading do an unhandled promise rejection from the offline check).