Swallowed Exception (ARCH3151)
Key typescript.logging.swallowed-exception · Severity warning · Category logging
A handler that catches an exception and silently discards it - returning null/false or ignoring it - hides the failure. This differs from a strictly empty block: there is a body, but the exception is lost.
Incorrect
Section titled “Incorrect”function getUser(id: string): User | null { try { return repository.findById(id); } catch (err) { return null; }}Correct
Section titled “Correct”function getUser(id: string): User | null { try { return repository.findById(id); } catch (err) { logger.error("failed to load user", { id, err }); return null; }}Log the caught exception or rethrow it before returning a fallback value.