MCPcopy Create free account
hub / github.com/monkeytypegame/monkeytype / handleErrorResponse

Function handleErrorResponse

backend/src/middlewares/error.ts:121–136  ·  view source on GitHub ↗
(
  res: Response,
  status: number,
  message: string,
  data?: ErrorData,
)

Source from the content-addressed store, hash-verified

119}
120
121function handleErrorResponse(
122 res: Response,
123 status: number,
124 message: string,
125 data?: ErrorData,
126): void {
127 res.status(status);
128 if (isCustomCode(status)) {
129 res.statusMessage = message;
130 }
131
132 //@ts-expect-error ignored so that we can see message in swagger stats
133 res.monkeyMessage = message;
134
135 res.json({ message, data: data ?? null });
136}
137
138export default errorHandlingMiddleware;

Callers 1

errorHandlingMiddlewareFunction · 0.85

Calls 1

isCustomCodeFunction · 0.90

Tested by

no test coverage detected