File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed
Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 14591459
14601460 var fetch_data = { ...data } ;
14611461
1462- if ( ! data . error ) {
1462+ if ( ! data . error && ! data . status_code ) {
14631463 console . warn ( 'No error param in registerFetchError data' ) ;
1464- } else {
1464+ } else if ( data . error ) {
14651465 // Convert runtime `error` to `error_code` and `error_message`.
14661466 if ( typeof data . error === 'string' ) {
14671467 fetch_data . error_code = data . error
Original file line number Diff line number Diff line change @@ -73,11 +73,6 @@ export default {
7373 return noCacheFound ( ) ;
7474 }
7575
76- options . registerFetch ( {
77- source : 'cache' ,
78- url : url
79- } ) ;
80-
8176 if ( data . error ) {
8277
8378 if ( data . error . redirect ) {
@@ -88,13 +83,36 @@ export default {
8883 }
8984 }
9085
86+ if ( data . error . responseStatusCode !== 200 ) {
87+ options . registerFetchError ( {
88+ source : 'cache' ,
89+ url : url ,
90+ status_code : data . error . responseStatusCode
91+ } ) ;
92+ }
93+
9194 // If data object has error attribute - return as error (e.g. redirect).
9295 log ( ' -- Using cached htmlparser error for: ' + url ) ;
9396 cb ( data . error ) ;
9497 } else if ( data . htmlparser ) {
98+
99+ if ( data . htmlparser . __statusCode !== 200 ) {
100+ options . registerFetchError ( {
101+ source : 'cache' ,
102+ url : url ,
103+ status_code : data . htmlparser . __statusCode
104+ } ) ;
105+ }
106+
95107 log ( ' -- Using cached htmlparser data for: ' + url ) ;
96108 cb ( null , data . htmlparser ) ;
97109 } else {
110+
111+ options . registerFetch ( {
112+ source : 'cache' ,
113+ url : url
114+ } ) ;
115+
98116 log ( ' -- Using cached meta for: ' + url ) ;
99117 cb ( null , {
100118 meta : data ,
You can’t perform that action at this time.
0 commit comments