AuthController: Return 409 Conflict when user already exists

The previously used HTTP error 400 'Bad Request' is not really
applicable here, as the client did not send a malformed message.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-10-27 19:39:18 +02:00
parent b73ac2f99b
commit c02f845ecb
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 3 additions and 2 deletions

View file

@ -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;
}