Skip to content

Commit e4c41dc

Browse files
committed
fix(ValidationExceptions): add condition when we fetch error messages
1 parent 2498fdd commit e4c41dc

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

generators/auth/templates/mongodb/jwt/src/exceptions/validation.exceptions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { BadRequestException, ValidationError } from '@nestjs/common';
22

33
function transform(errors: ValidationError[]) {
4-
return errors.map((error) => {
5-
return Object.values(error.constraints) ?? [];
6-
});
4+
return errors.map((error) => (error.constraints ? Object.values(error.constraints) : []));
75
}
86

97
export default class ValidationExceptions extends BadRequestException {

0 commit comments

Comments
 (0)