Pushing errors back to frontend
All checks were successful
Music Collection CI Workflow / test (./backend) (push) Successful in 35s
Music Collection CI Workflow / test (./frontend) (push) Successful in 39s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Successful in 52s
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Successful in 1m51s
Music Collection CI Workflow / deploy (push) Successful in 24s
All checks were successful
Music Collection CI Workflow / test (./backend) (push) Successful in 35s
Music Collection CI Workflow / test (./frontend) (push) Successful in 39s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Successful in 52s
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Successful in 1m51s
Music Collection CI Workflow / deploy (push) Successful in 24s
This commit is contained in:
parent
6a2c451105
commit
44e82567ed
@ -1,9 +1,5 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import {
|
||||
UnprocessableEntityException,
|
||||
ValidationError,
|
||||
ValidationPipe,
|
||||
} from '@nestjs/common';
|
||||
import { UnprocessableEntityException, ValidationError, ValidationPipe } from '@nestjs/common';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
@ -26,8 +22,7 @@ async function bootstrap() {
|
||||
validationErrors: ValidationError[],
|
||||
parentProperty = '',
|
||||
): Array<{ property: string; errors: string[] }> => {
|
||||
const errors: Array<{ property: string; errors: string[] }> = [];
|
||||
|
||||
const errors : Array<{ property: string; errors: string[] }> = [];
|
||||
const getValidationErrorsRecursively = (
|
||||
validationErrors: ValidationError[],
|
||||
parentProperty = '',
|
||||
@ -43,20 +38,15 @@ async function bootstrap() {
|
||||
errors: Object.values(error.constraints),
|
||||
});
|
||||
}
|
||||
|
||||
if (error.children?.length) {
|
||||
getValidationErrorsRecursively(error.children, propertyPath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getValidationErrorsRecursively(validationErrors, parentProperty);
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
const errors = getPrettyClassValidatorErrors(validationErrors);
|
||||
|
||||
return new UnprocessableEntityException({
|
||||
message: 'validation error',
|
||||
errors: errors,
|
||||
|
@ -111,7 +111,6 @@ export default function Page() {
|
||||
setSnackbarMessage(message);
|
||||
setSnackbarSuccess(severity);
|
||||
handleOpenSnackbar();
|
||||
|
||||
}
|
||||
|
||||
if (!albums) return <div>Loading...</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user