Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #255 from WisdomWorks/dev-herry-ho
Browse files Browse the repository at this point in the history
fix: handle email duplicate message
  • Loading branch information
HoXuanHieu authored Apr 24, 2024
2 parents 77fd02d + 5d503df commit eca9b44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/example/codeE/service/user/UserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public User createOne(CreateUserRequest userRequest) {
LoggerHelper.logError(e.getMessage());
if (e.getMessage().equals("could not execute statement [Duplicate entry '" + userRequest.getUsername() + "' for key 'user.username'] [insert into user (created_date,email,name,password,role,updated_date,username,user_id) values (?,?,?,?,?,?,?,?)]; SQL [insert into user (created_date,email,name,password,role,updated_date,username,user_id) values (?,?,?,?,?,?,?,?)]; constraint [user.username]"))
throw new RuntimeException("User Name can not duplicate");
if (e.getMessage().equals("could not execute statement [Duplicate entry '" + userRequest.getEmail() + "' for key 'user.username'] [insert into user (created_date,email,name,password,role,updated_date,username,user_id) values (?,?,?,?,?,?,?,?)]; SQL [insert into user (created_date,email,name,password,role,updated_date,username,user_id) values (?,?,?,?,?,?,?,?)]; constraint [user.username]"))
if (e.getMessage().equals("could not execute statement [Duplicate entry '" + userRequest.getEmail() + "' for key 'user.email'] [insert into user (created_date,email,name,password,role,updated_date,username,user_id) values (?,?,?,?,?,?,?,?)]; SQL [insert into user (created_date,email,name,password,role,updated_date,username,user_id) values (?,?,?,?,?,?,?,?)]; constraint [user.email]"))
throw new RuntimeException("Email can not duplicate");
throw new RuntimeException("Something wrong when create user");
}
Expand Down

0 comments on commit eca9b44

Please sign in to comment.