Skip to content

Silent catch blocks swallow errors, making debugging difficult #63359

@WadydX

Description

@WadydX

Description

Multiple locations in the codebase use empty catch blocks (} catch {}) that silently swallow errors. This makes debugging failures difficult and can mask real issues in production.

Locations Found

File Line Context
src/pairing/pairing-store.ts 510 } catch {}
src/pairing/setup-code.ts 129, 166 } catch {} (2 instances)
src/infra/home-dir.ts 63 } catch {}
src/infra/brew.ts 9 } catch {}
src/infra/ports-lsof.ts 13, 32 } catch {} (2 instances)

Expected Behavior

Errors should be logged at minimum (even at debug level) so failures are traceable during troubleshooting.

Suggested Fix

Replace empty catch blocks with minimal logging:

} catch (err) {
  logger.debug("Operation failed:", err);
}

Or if the error is truly expected/ignorable, add an explicit comment explaining why:

} catch {
  // Intentionally ignored: file may not exist on first run
}

Impact

  • Debugging failures requires adding manual instrumentation
  • Silent failures may go unnoticed in production
  • Harder to diagnose user-reported issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions