add: proper msg for group delete

location-fix
Thilina Sandaruwan 1 year ago
parent 240ccf970e
commit 6c645db486

@ -475,8 +475,8 @@ public class GroupManagementServiceImpl implements GroupManagementService {
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (GroupAlreadyExistException e) { } catch (GroupAlreadyExistException e) {
String msg = "Group already exists with name : " + groups.getName() + "."; String msg = "Group already exists with name : " + groups.getName() + " Try with another group name.";
log.warn(msg); log.error(msg, e);
return Response.status(Response.Status.CONFLICT).entity(msg).build(); return Response.status(Response.Status.CONFLICT).entity(msg).build();
} catch (RoleDoesNotExistException e) { } catch (RoleDoesNotExistException e) {
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();

@ -187,8 +187,8 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (GroupAlreadyExistException e) { } catch (GroupAlreadyExistException e) {
String msg = "Group already exists with name : " + group.getName() + "."; String msg = "Group already exists with name : " + group.getName() + " Try with another group name.";
log.warn(msg); log.error(msg, e);
return Response.status(Response.Status.CONFLICT).entity(msg).build(); return Response.status(Response.Status.CONFLICT).entity(msg).build();
} catch (RoleDoesNotExistException e) { } catch (RoleDoesNotExistException e) {
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();

@ -57,7 +57,7 @@ public interface GroupManagementProviderService {
* @param defaultPermissions of the default role * @param defaultPermissions of the default role
* @throws GroupManagementException * @throws GroupManagementException
*/ */
void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupManagementException, GroupAlreadyExistException, RoleDoesNotExistException; void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupAlreadyExistException,GroupManagementException, RoleDoesNotExistException;
/** /**
* Update existing device group. * Update existing device group.

@ -148,7 +148,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
} }
} }
public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupManagementException { public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupAlreadyExistException, GroupManagementException {
if (groups == null) { if (groups == null) {
String msg = "Received incomplete data for createGroup"; String msg = "Received incomplete data for createGroup";
log.error(msg); log.error(msg);
@ -181,7 +181,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
} }
GroupManagementDAOFactory.commitTransaction(); GroupManagementDAOFactory.commitTransaction();
} else { } else {
throw new GroupManagementException("Group exist with name " + groups.getName()); throw new GroupAlreadyExistException("Group already exists with name : " + groups.getName() + " Try with another group name.");
} }
} catch (GroupManagementDAOException e) { } catch (GroupManagementDAOException e) {
GroupManagementDAOFactory.rollbackTransaction(); GroupManagementDAOFactory.rollbackTransaction();

Loading…
Cancel
Save