MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / extractFieldErrors

Function extractFieldErrors

apps/api/src/middleware/error-handler.ts:22–35  ·  view source on GitHub ↗
(
  error: unknown
)

Source from the content-addressed store, hash-verified

20 * still gets the raw framework message in dev via the stack field.
21 */
22const extractFieldErrors = (
23 error: unknown
24): Record<string, string> | undefined => {
25 if (
26 error instanceof Error &&
27 "field" in error &&
28 typeof error.field === "string" &&
29 error.field !== ""
30 ) {
31 return { [error.field]: "Invalid value" };
32 }
33
34 return undefined;
35};
36
37const FRAMEWORK_SAFE_MESSAGES: Record<string, string> = {
38 [ElysiaErrorCodes.VALIDATION]: "Validation failed",

Callers 1

errorHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected