diff --git a/src/api/private/auth/auth.controller.ts b/src/api/private/auth/auth.controller.ts index 334a1d29b..b2f0b3bc7 100644 --- a/src/api/private/auth/auth.controller.ts +++ b/src/api/private/auth/auth.controller.ts @@ -6,6 +6,7 @@ import { BadRequestException, Body, + ConflictException, Controller, Delete, NotFoundException, @@ -56,7 +57,7 @@ export class AuthController { return; } catch (e) { if (e instanceof AlreadyInDBError) { - throw new BadRequestException(e.message); + throw new ConflictException(e.message); } throw e; } diff --git a/test/private-api/auth.e2e-spec.ts b/test/private-api/auth.e2e-spec.ts index 7df133331..c1976f219 100644 --- a/test/private-api/auth.e2e-spec.ts +++ b/test/private-api/auth.e2e-spec.ts @@ -75,7 +75,7 @@ describe('Auth', () => { .post('/api/private/auth/local') .set('Content-Type', 'application/json') .send(JSON.stringify(registrationDto)) - .expect(400); + .expect(409); }); it('when registration is disabled', async () => { testSetup.configService.get('authConfig').local.enableRegister = false;