mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
making error messages more meaningful
This commit is contained in:
parent
85752584bb
commit
80941b8d2b
@ -30,7 +30,7 @@ import java.util.List;
|
||||
description = "FileTransfer related Information.")
|
||||
public class FileTransferBeanWrapper {
|
||||
|
||||
@ApiModelProperty(name = "deviceIDs", value = "Device id list of the operation to be executed.", required = true)
|
||||
@ApiModelProperty(name = "deviceIDs", value = "Device id list to which the operation to be executed.", required = true)
|
||||
private List<String> deviceIDs;
|
||||
|
||||
@ApiModelProperty(name = "operation", value = "Information of the File Transfer Operation.", required = true)
|
||||
|
||||
@ -232,7 +232,6 @@ public interface DeviceManagementAdminService {
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
//todo
|
||||
value = "Transferring file to the device.",
|
||||
notes = "Using this API you have the option to transfer a file from FTP server to an Android device.",
|
||||
response = Activity.class,
|
||||
|
||||
@ -95,12 +95,12 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
@Override
|
||||
public Response fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android file transfer operation");
|
||||
log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs());
|
||||
}
|
||||
|
||||
try {
|
||||
if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null) {
|
||||
String errorMessage = "Lock bean is empty.";
|
||||
String errorMessage = "The payload of the file transfer operation is incorrect.";
|
||||
log.error(errorMessage);
|
||||
throw new BadRequestException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||
@ -113,17 +113,17 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
operation.setPayLoad(file.toJSON());
|
||||
return AndroidAPIUtils.getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation);
|
||||
} catch (InvalidDeviceException e) {
|
||||
String errorMessage = "Invalid Device Identifiers found.";
|
||||
String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found.";
|
||||
log.error(errorMessage, e);
|
||||
throw new BadRequestException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||
} catch (OperationManagementException e) {
|
||||
String errorMessage = "Issue in retrieving operation management service instance";
|
||||
String errorMessage = "Issue in retrieving operation management service instance for file transfer operation";
|
||||
log.error(errorMessage, e);
|
||||
throw new UnexpectedServerErrorException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());
|
||||
} catch (DeviceManagementException e) {
|
||||
String errorMessage = "Issue in retrieving device management service instance";
|
||||
String errorMessage = "Issue in retrieving device management service instance for file transfer operation";
|
||||
log.error(errorMessage, e);
|
||||
throw new UnexpectedServerErrorException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user