Commit 04ea404eedf8eddff01c81690763eab072a43cf3
1 parent
2e6ddb3e
fix: [DEFECT-1550] 新增、编辑存在的产品名称时,没有把异常正确返回给前端
Showing
1 changed file
with
5 additions
and
2 deletions
... | ... | @@ -65,14 +65,17 @@ public class TkDeviceProfileController extends BaseController { |
65 | 65 | deviceProfileDTO.setTbProfileId(saveDeviceProfile.getId().toString()); |
66 | 66 | tkDeviceProfileService.insertOrUpdate(deviceProfileDTO); |
67 | 67 | }catch (Exception e){ |
68 | - if (created) { | |
68 | + if (created && null !=saveDeviceProfile) { | |
69 | 69 | logEntityAction(emptyId(EntityType.DEVICE_PROFILE), saveDeviceProfile, |
70 | 70 | null, created ? ActionType.ADDED : ActionType.UPDATED, e); |
71 | 71 | deviceProfileService.deleteDeviceProfile(getTenantId(), saveDeviceProfile.getId()); |
72 | 72 | tbClusterService.onDeviceProfileDelete(saveDeviceProfile, null); |
73 | 73 | tbClusterService.broadcastEntityStateChangeEvent(saveDeviceProfile.getTenantId(), saveDeviceProfile.getId(), ComponentLifecycleEvent.DELETED); |
74 | - throw handleException(e); | |
75 | 74 | } |
75 | + if(e instanceof TkDataValidationException){ | |
76 | + throw new TkDataValidationException(e.getMessage()); | |
77 | + } | |
78 | + throw handleException(e); | |
76 | 79 | } |
77 | 80 | |
78 | 81 | ... | ... |