Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit 4252469

Browse files
Claudio Procidafacebook-github-bot
authored andcommitted
fix(chore): fixes webpack-stream error with missing catch var declaration (#2291)
Summary: **Summary** Fixes an error thrown by `webpack-stream` with the missing catch var declaration ``` [16:12:34] '<anonymous>' errored after 8.42 s [16:12:34] Error in plugin "webpack-stream" Message: ./lib/setDraftEditorSelection.js Module parse failed: Unexpected token (278:12) You may need an appropriate loader to handle this file type. | try { | selection.addRange(range); | } catch {// ignore | } | } else { @ ./lib/DraftEditorLeaf.react.js 29:30-66 @ ./lib/DraftEditorBlock.react.js @ ./lib/Draft.js Details: domain: [object Object] domainThrown: true ``` **Test Plan** ``` yarn ``` Build completes without errors Pull Request resolved: #2291 Reviewed By: mrkev Differential Revision: D19230824 Pulled By: claudiopro fbshipit-source-id: 9fdc2ebbee654404458851f6fd14a367c33a23e4
1 parent 64b51df commit 4252469

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

meta/bundle-size-stats/Draft.js.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

meta/bundle-size-stats/Draft.min.js.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/component/selection/setDraftEditorSelection.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function addFocusToSelection(
253253
// the call to 'selection.extend' is about to throw
254254
DraftJsDebugLogging.logSelectionStateFailure({
255255
anonymizedDom: getAnonymizedEditorDOM(node),
256-
extraParams: JSON.stringify({offset: offset}),
256+
extraParams: JSON.stringify({offset}),
257257
selectionState: JSON.stringify(selectionState.toJS()),
258258
});
259259
}
@@ -292,7 +292,7 @@ function addFocusToSelection(
292292
: null,
293293
selectionFocusOffset: selection.focusOffset,
294294
message: e ? '' + e : null,
295-
offset: offset,
295+
offset,
296296
},
297297
null,
298298
2,
@@ -329,7 +329,7 @@ function addPointToSelection(
329329
// in this case we know that the call to 'range.setStart' is about to throw
330330
DraftJsDebugLogging.logSelectionStateFailure({
331331
anonymizedDom: getAnonymizedEditorDOM(node),
332-
extraParams: JSON.stringify({offset: offset}),
332+
extraParams: JSON.stringify({offset}),
333333
selectionState: JSON.stringify(selectionState.toJS()),
334334
});
335335
DraftEffects.handleExtensionCausedError();
@@ -340,8 +340,11 @@ function addPointToSelection(
340340
if (isIE) {
341341
try {
342342
selection.addRange(range);
343-
} catch {
344-
// ignore
343+
} catch (e) {
344+
if (__DEV__) {
345+
/* eslint-disable-next-line no-console */
346+
console.warn('Call to selection.addRange() threw exception: ', e);
347+
}
345348
}
346349
} else {
347350
selection.addRange(range);

0 commit comments

Comments
 (0)