chore: Made it possible to output multiple errors, not just the first one
This commit is contained in:
parent
7605c5190a
commit
97fa1bd066
1 changed files with 2 additions and 1 deletions
|
@ -28,7 +28,8 @@ async function validateCurrency(data) {
|
|||
const validatedData = await currencySchema.validateAsync(data);
|
||||
return validatedData;
|
||||
} catch (error) {
|
||||
throw new Error(`Validation error \n${JSON.stringify(error.details[0], null, '\t')}`);
|
||||
const errorMessages = error.details.map(e => e.message).join('; ');
|
||||
throw new Error(`Validation error(s): ${errorMessages}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue