📦 EqualifyEverything / equalify-iris

📄 errors.ts · 13 lines
1
2
3
4
5
6
7
8
9
10
11
12
13import type { Response } from "express";

// Standard error structure (PRD §9.3).
export function sendError(
  res: Response,
  httpStatus: number,
  code: string,
  message: string,
  details: Record<string, unknown> = {},
): void {
  res.status(httpStatus).json({ error: { code, message, details } });
}