Skip to content

Commit c2f8206

Browse files
committed
Removed silent empty catches and replaced them with intentional handling (recoverable warnings, fallback behavior, or safer guards)
1 parent 587e2c4 commit c2f8206

File tree

17 files changed

+228
-120
lines changed

17 files changed

+228
-120
lines changed

package-lock.json

Lines changed: 6 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cm/lsp/workspace.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ export default class AcodeWorkspace extends Workspace {
109109
if (mode?.name) {
110110
return String(mode.name).toLowerCase();
111111
}
112-
} catch (_) {}
112+
} catch (error) {
113+
console.warn(
114+
`[LSP:Workspace] Failed to resolve language id for ${uri}`,
115+
error,
116+
);
117+
}
113118
return "plaintext";
114119
}
115120

src/lib/editorFile.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,12 @@ export default class EditorFile {
10001000
EditorState.readOnly.of(!!value),
10011001
),
10021002
});
1003-
} catch (_) {}
1003+
} catch (error) {
1004+
console.warn(
1005+
`Failed to update read-only state for ${this.filename || this.uri}`,
1006+
error,
1007+
);
1008+
}
10041009

10051010
// Sync internal flags and header
10061011
this.readOnly = !!value;
@@ -1072,7 +1077,9 @@ export default class EditorFile {
10721077
// Ensure any native DOM selection is cleared on blur to avoid sticky selection handles
10731078
try {
10741079
document.getSelection()?.removeAllRanges();
1075-
} catch (_) {}
1080+
} catch (error) {
1081+
console.warn("Failed to clear native text selection.", error);
1082+
}
10761083
}
10771084
} else {
10781085
editorManager.container.style.display = "none";
@@ -1322,7 +1329,9 @@ export default class EditorFile {
13221329
if (activeFile?.id === this.id) {
13231330
emit("file-loaded", this);
13241331
}
1325-
} catch (_) {}
1332+
} catch (error) {
1333+
console.warn("Failed to emit interim file-loaded event.", error);
1334+
}
13261335

13271336
try {
13281337
const cacheFs = fsOperation(this.cacheFile);

0 commit comments

Comments
 (0)