Fix metadata exception handler #2 (#3357)

This commit is contained in:
Weiko
2024-01-10 17:02:54 +01:00
committed by GitHub
parent 4f9ea78258
commit 22047fa2bf
9 changed files with 17 additions and 24 deletions

View File

@ -19,14 +19,10 @@ export class FieldMetadataResolver {
@Args('input') input: CreateOneFieldMetadataInput,
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.fieldMetadataService.createOne({
...input.field,
workspaceId,
});
} catch (error) {
console.log(error);
}
return this.fieldMetadataService.createOne({
...input.field,
workspaceId,
});
}
@Mutation(() => FieldMetadataDTO)

View File

@ -56,7 +56,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
);
if (!objectMetadata) {
throw new Error('Object does not exist');
throw new NotFoundException('Object does not exist');
}
const fieldAlreadyExists = await this.fieldMetadataRepository.findOne({