Skip to content

Title: refactor(error-handling): centralize duplicate try/catch blocks into Express error middleware #191

Description

@Satvik77777

The same try/catch -> console.log -> res.status(500)
pattern is duplicated 20+ times across agreements.ts,
crud.ts, and mcp.ts. Several console.log statements
also expose PII (req.body, contract data) and internal
details (SQL queries, stack traces) to stdout.

This issue tracks:

  1. Creating server/middleware/errorHandler.ts with
    globalErrorHandler and asyncHandler utilities
  2. Refactoring all route handlers to use asyncHandler
  3. Removing PII-exposing console.log statements
  4. Replacing with structured non-leaking error logging

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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