-
Notifications
You must be signed in to change notification settings - Fork 823
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
Consistently reject with a WorkboxError when a strategy fails #1657
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.
LGTM with one optional suggestion.
@@ -123,7 +127,10 @@ class CacheOnly { | |||
logger.groupEnd(); | |||
} | |||
|
|||
return response; | |||
if (response) { |
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.
Nit: to me it'd make slightly more sense to invert this condition, i.e. throw when there's not a response and default to returning the response. As it is now, it looks like throwing is the default, unconditional behavior (but maybe that's just how I read it).
@@ -175,7 +179,10 @@ class NetworkFirst { | |||
logger.groupEnd(); | |||
} | |||
|
|||
return response; | |||
if (response) { |
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.
Same comment as above, here and presumably elsewhere.
Updated with review feedback. |
PR-Bot Size PluginChanged File Sizes
New FilesNo new files have been added. All File SizesView Table
Workbox Aggregate Size Plugin9.44KB gzip'ed (63% of limit) |
R: @philipwalton
CC: @devnook @sorendam
Fixes #1551, to be merged into the
next
branch.Previously, some strategies would resolve with
null
instead of rejecting.There are some updates to the docs that will end up accompanying this (once
v4
goes live). For one thing, it makes it easier to provide fallback content viaworkbox.routing.setCatchHandler()
.