change exception texts

This commit is contained in:
Yuriy Lytvynchuk 2023-01-23 12:36:30 +02:00
parent 892cc1a907
commit 0a57fc78dd
2 changed files with 4 additions and 4 deletions

View File

@ -40,11 +40,11 @@ public class TbAssetTypeSwitchNode extends TbAbstractTypeSwitchNode {
protected String getRelationType(TbContext ctx, EntityId originator) { protected String getRelationType(TbContext ctx, EntityId originator) {
if (!EntityType.ASSET.equals(originator.getEntityType())) { if (!EntityType.ASSET.equals(originator.getEntityType())) {
throw new RuntimeException("Unsupported originator type: " + originator.getEntityType() + "!"); throw new RuntimeException("Unsupported originator type: " + originator.getEntityType() + "! Only 'ASSET' type is allowed.");
} }
AssetProfile assetProfile = ctx.getAssetProfileCache().get(ctx.getTenantId(), (AssetId) originator); AssetProfile assetProfile = ctx.getAssetProfileCache().get(ctx.getTenantId(), (AssetId) originator);
if (assetProfile == null) { if (assetProfile == null) {
throw new RuntimeException("Asset profile with entity id: " + originator.getId() + " wasn't found!"); throw new RuntimeException("Asset profile for entity id: " + originator.getId() + " wasn't found!");
} }
return assetProfile.getName(); return assetProfile.getName();
} }

View File

@ -40,11 +40,11 @@ public class TbDeviceTypeSwitchNode extends TbAbstractTypeSwitchNode {
protected String getRelationType(TbContext ctx, EntityId originator) { protected String getRelationType(TbContext ctx, EntityId originator) {
if (!EntityType.DEVICE.equals(originator.getEntityType())) { if (!EntityType.DEVICE.equals(originator.getEntityType())) {
throw new RuntimeException("Unsupported originator type: " + originator.getEntityType() + "!"); throw new RuntimeException("Unsupported originator type: " + originator.getEntityType() + "! Only 'DEVICE' type is allowed.");
} }
DeviceProfile deviceProfile = ctx.getDeviceProfileCache().get(ctx.getTenantId(), (DeviceId) originator); DeviceProfile deviceProfile = ctx.getDeviceProfileCache().get(ctx.getTenantId(), (DeviceId) originator);
if (deviceProfile == null) { if (deviceProfile == null) {
throw new RuntimeException("Device profile with entity id: " + originator.getId() + " wasn't found!"); throw new RuntimeException("Device profile for entity id: " + originator.getId() + " wasn't found!");
} }
return deviceProfile.getName(); return deviceProfile.getName();
} }