Skip to content

Commit c780a96

Browse files
authored
Fix error where an error is thrown when a module is not found (codesandbox#3032)
1 parent 23951d3 commit c780a96

File tree

1 file changed

+10
-6
lines changed
  • packages/app/src/app/overmind/namespaces/editor

1 file changed

+10
-6
lines changed

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,13 +574,17 @@ export const previewActionReceived: Action<{
574574

575575
if (newErrors.length !== currentErrors.length) {
576576
state.editor.errors.forEach(error => {
577-
const module = resolveModule(
578-
error.path,
579-
state.editor.currentSandbox.modules,
580-
state.editor.currentSandbox.directories
581-
);
577+
try {
578+
const module = resolveModule(
579+
error.path,
580+
state.editor.currentSandbox.modules,
581+
state.editor.currentSandbox.directories
582+
);
582583

583-
module.errors = [];
584+
module.errors = [];
585+
} catch (e) {
586+
// Module doesn't exist anymore
587+
}
584588
});
585589
state.editor.errors = newErrors;
586590
}

0 commit comments

Comments
 (0)