Skip to content

Commit e08a873

Browse files
committed
JS: Tolerate TypeScript files being requested out of order
1 parent a2659ee commit e08a873

File tree

1 file changed

+4
-1
lines changed
  • javascript/extractor/lib/typescript/src

1 file changed

+4
-1
lines changed

javascript/extractor/lib/typescript/src/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ function handleParseCommand(command: ParseCommand, checkPending = true) {
361361
let filename = command.filename;
362362
let expectedFilename = state.pendingFiles[state.pendingFileIndex];
363363
if (expectedFilename !== filename && checkPending) {
364-
throw new Error("File requested out of order. Expected '" + expectedFilename + "' but got '" + filename + "'");
364+
// File was requested out of order. This happens in rare cases because the Java process decided against extracting it,
365+
// for example because it was too large. Just recover and accept that some work was wasted.
366+
state.pendingResponse = null;
367+
state.pendingFileIndex = state.pendingFiles.indexOf(filename);
365368
}
366369
++state.pendingFileIndex;
367370
let response = state.pendingResponse || extractFile(command.filename);

0 commit comments

Comments
 (0)