fix: display platform registration errors inside the creation modal

This commit is contained in:
2026-09-29 13:28:31 +09:00
parent 763ff22284
commit 7c3f7c8dc1
2 changed files with 63 additions and 4 deletions
+6 -4
View File
@@ -2178,9 +2178,7 @@ export class InstructorService {
organizationId,
organizationName,
),
displayName: {
startsWith: baseName,
},
platformId: masterPlatform.id,
},
select: {
displayName: true,
@@ -2227,7 +2225,11 @@ export class InstructorService {
});
} catch (error) {
if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === 'P2002') {
throw new ConflictException('Platform name already exists');
const target = error.meta?.target;
if (Array.isArray(target) && target.includes('instance_no')) {
throw new ConflictException('플랫폼 등록번호가 중복되었습니다. 다시 등록해 주세요.');
}
throw new ConflictException('이미 사용 중인 플랫폼 이름입니다. 다른 이름을 입력해 주세요.');
}
throw error;
}