From 64e55629f18dd8689400fb6879d1c8c6bd932a52 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Wed, 6 Nov 2019 14:59:06 +0530 Subject: [PATCH] Refactor the error message --- .../RemoteSessionManagementServiceImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/src/main/java/org/wso2/carbon/device/mgt/extensions/remote.session/RemoteSessionManagementServiceImpl.java b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/src/main/java/org/wso2/carbon/device/mgt/extensions/remote.session/RemoteSessionManagementServiceImpl.java index 3b4f6c61f2..9af8618eed 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/src/main/java/org/wso2/carbon/device/mgt/extensions/remote.session/RemoteSessionManagementServiceImpl.java +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/src/main/java/org/wso2/carbon/device/mgt/extensions/remote.session/RemoteSessionManagementServiceImpl.java @@ -110,12 +110,15 @@ public class RemoteSessionManagementServiceImpl implements RemoteSessionManageme + " , deviceId : " + deviceId); } } catch (OperationManagementException | InvalidDeviceException e) { - log.error("error", e); - throw new RemoteSessionManagementException("Error occurred while adding initial operation for the " + - "device Type : " + deviceType + " , deviceId : " + deviceId); + String msg = "Error occurred while adding initial operation for the " + + "device Type : " + deviceType + " , deviceId : " + deviceId; + log.error(msg, e); + throw new RemoteSessionManagementException(msg); } catch (DeviceAccessAuthorizationException e) { - throw new RemoteSessionManagementException("Error occurred while device access authorization for the " + - "device Type : " + deviceType + " , " + "deviceId : " + deviceId); + String msg = "Error occurred while device access authorization for the " + + "device Type : " + deviceType + " , " + "deviceId : " + deviceId; + log.error(msg, e); + throw new RemoteSessionManagementException(msg); } finally { PrivilegedCarbonContext.endTenantFlow(); }