File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,18 @@ export default class StackParser {
132132 * Wait for maximum 2 sec to skip loading big files.
133133 */
134134 this . sourceFilesCache [ fileName ] = fetchTimer ( fileName , 2000 )
135- . then ( ( response ) => response . text ( ) ) ;
135+ . then ( ( response ) => response . text ( ) )
136+ . catch ( ( error ) => {
137+ /**
138+ * Remove failed promise from cache to allow retry
139+ */
140+ delete this . sourceFilesCache [ fileName ] ;
141+
142+ /**
143+ * Re-throw error so it can be caught by try-catch
144+ */
145+ throw error ;
146+ } ) ;
136147
137148 /**
138149 * Dealloc cache when it collects more that 10 files
@@ -146,7 +157,12 @@ export default class StackParser {
146157
147158 return await this . sourceFilesCache [ fileName ] ;
148159 } catch ( error ) {
160+ /**
161+ * Ensure failed promise is removed from cache
162+ */
163+ delete this . sourceFilesCache [ fileName ] ;
149164 // log('Can not load source file. Skipping...');
165+
150166 return null ;
151167 }
152168 }
You can’t perform that action at this time.
0 commit comments