Empty Catch Block (ARCH3150)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key typescript.logging.empty-catch-block · Severity warning · Category logging
A catch block with an empty body (or only comments) silently swallows the exception. This hides bugs and lets faulty state continue unnoticed.
Incorrect
Section titled “Incorrect”function loadConfig(path: string): Config { try { return JSON.parse(readFileSync(path, "utf8")); } catch { // ignore } return defaultConfig;}Correct
Section titled “Correct”function loadConfig(path: string): Config { try { return JSON.parse(readFileSync(path, "utf8")); } catch (err) { logger.warn("config unreadable, using default", { path, err }); return defaultConfig; }}At minimum log the exception or rethrow it; never swallow it silently.