mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(core): handle unexpected user unique identifier error (#6902)
handle unexpected user unqque identifier violation error
This commit is contained in:
parent
e312a9830b
commit
ea5a62bf8a
1 changed files with 21 additions and 0 deletions
|
@ -57,6 +57,27 @@ export default function koaSlonikErrorHandler<StateT, ContextT>(): Middleware<St
|
|||
status: 422,
|
||||
});
|
||||
}
|
||||
|
||||
if (error.constraint === 'users__username') {
|
||||
throw new RequestError({
|
||||
code: 'user.username_already_in_use',
|
||||
status: 422,
|
||||
});
|
||||
}
|
||||
|
||||
if (error.constraint === 'users__primary_email') {
|
||||
throw new RequestError({
|
||||
code: 'user.email_already_in_use',
|
||||
status: 422,
|
||||
});
|
||||
}
|
||||
|
||||
if (error.constraint === 'users__primary_phone') {
|
||||
throw new RequestError({
|
||||
code: 'user.phone_already_in_use',
|
||||
status: 422,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (error instanceof CheckIntegrityConstraintViolationError) {
|
||||
|
|
Loading…
Reference in a new issue