Skip to content

Commit a563a75

Browse files
committed
Update stackParser.ts
1 parent 924a1ea commit a563a75

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/modules/stackParser.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)