修复错误捕获
This commit is contained in:
@@ -24,7 +24,7 @@ export class UserService {
|
|||||||
async create(user: Partial<User>): Promise<User> {
|
async create(user: Partial<User>): Promise<User> {
|
||||||
try {
|
try {
|
||||||
const newUser = this.userRepository.create(user);
|
const newUser = this.userRepository.create(user);
|
||||||
return this.userRepository.save(newUser);
|
return await this.userRepository.save(newUser);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof QueryFailedError) {
|
if (error instanceof QueryFailedError) {
|
||||||
throw new ConflictException(this.getDuplicateErrorMessage(error));
|
throw new ConflictException(this.getDuplicateErrorMessage(error));
|
||||||
|
|||||||
Reference in New Issue
Block a user