feat(SW-1773): add proper validation to form and query
This commit is contained in:
@@ -40,6 +40,14 @@ export function notFound(cause?: unknown) {
|
||||
})
|
||||
}
|
||||
|
||||
export function unprocessableContent(cause?: unknown) {
|
||||
return new TRPCError({
|
||||
code: "UNPROCESSABLE_CONTENT",
|
||||
message: "Unprocessable content",
|
||||
cause,
|
||||
})
|
||||
}
|
||||
|
||||
export function internalServerError(cause?: unknown) {
|
||||
return new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
@@ -78,6 +86,8 @@ export function serverErrorByStatus(status: number, cause?: unknown) {
|
||||
return notFound(cause)
|
||||
case 409:
|
||||
return conflictError(cause)
|
||||
case 422:
|
||||
return unprocessableContent(cause)
|
||||
case 500:
|
||||
default:
|
||||
return internalServerError(cause)
|
||||
|
||||
Reference in New Issue
Block a user