diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 5879637..3cfebc3 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -77,7 +77,7 @@ export class AuthController { }, }) @ApiResponse({ status: 400, description: 'Validation error' }) - @ApiResponse({ status: 409, description: 'Email already registered' }) + @ApiResponse({ status: 409, description: 'Email address is already registered as an agent or user' }) async register(@Body() dto: RegisterDto) { return this.authService.register(dto); } diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 55cff62..c9ed375 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -65,7 +65,10 @@ export class AuthService { }); if (existingUser) { - throw new ConflictException('Email already registered'); + const existingRoleLabel = existingUser.role === UserRole.AGENT ? 'agent' : 'user'; + throw new ConflictException( + `Email address is already registered as an ${existingRoleLabel}. Kindly use a different email address for the new signup.`, + ); } // Hash password