Skip to content

Commit cd65e89

Browse files
committed
fix wrong fetch errors registering
1 parent 16e6b5a commit cd65e89

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/plugins/system/meta/cachedMeta.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ export default {
8383
}
8484
}
8585

86-
if (data.error.responseStatusCode !== 200) {
87-
// TODO: why `data.error.responseStatusCode` can be `undefined`
86+
// Redirects don't have `responseStatusCode`. Only errors have status.
87+
if (data.error.responseStatusCode
88+
&& data.error.responseStatusCode !== 200) {
8889
options.registerFetchError({
8990
source: 'cache',
9091
url: url,
@@ -97,7 +98,9 @@ export default {
9798
cb(data.error);
9899
} else if (data.htmlparser) {
99100

100-
if (data.htmlparser.__statusCode !== 200) {
101+
// Wrong content types don't have `__statusCode`. Only errors have status.
102+
if (data.htmlparser.__statusCode
103+
&& data.htmlparser.__statusCode !== 200) {
101104
// TODO: why `data.htmlparser.__statusCode` can be `undefined`
102105
options.registerFetchError({
103106
source: 'cache',

0 commit comments

Comments
 (0)