Mejora de las respuestas de error
This commit is contained in:
parent
98a0231906
commit
4c891fb8c8
@ -1,9 +1,9 @@
|
||||
import { Result } from "@repo/rdx-utils";
|
||||
import {
|
||||
DomainValidationError,
|
||||
ValidationErrorDetail,
|
||||
isDomainValidationError,
|
||||
isValidationErrorCollection,
|
||||
ValidationErrorDetail,
|
||||
} from "../errors";
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ export function extractOrPushError<T>(
|
||||
error.details?.forEach((detail) => {
|
||||
errors.push({
|
||||
...detail,
|
||||
path: detail.path ?? path,
|
||||
path: path ?? detail.path,
|
||||
});
|
||||
});
|
||||
} else if (isDomainValidationError(error)) {
|
||||
|
||||
@ -9,8 +9,8 @@ export function translateZodValidationError<T>(
|
||||
const errors: ValidationErrorDetail[] = [];
|
||||
for (const issue of zodError.issues) {
|
||||
errors.push({
|
||||
message: issue.message,
|
||||
path: issue.path.join("."),
|
||||
message: `${message}: ${issue.message}`,
|
||||
path: issue.path ? issue.path.join(".") : undefined,
|
||||
value: errorValue ?? issue.input,
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user