in iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/IotHubStatusCode.java [97:142]
public static IotHubServiceException getConnectionStatusException(IotHubStatusCode statusCode, String statusDescription)
{
IotHubServiceException transportException;
switch (statusCode)
{
case OK:
case MESSAGE_CANCELLED_ONCLOSE:
case MESSAGE_EXPIRED:
transportException = null;
break;
case BAD_FORMAT:
transportException = new BadFormatException(statusDescription);
break;
case UNAUTHORIZED:
transportException = new UnauthorizedException(statusDescription);
break;
case QUOTA_EXCEEDED:
transportException = new QuotaExceededException(statusDescription);
break;
case NOT_FOUND:
transportException = new HubOrDeviceIdNotFoundException(statusDescription);
break;
case PRECONDITION_FAILED:
transportException = new PreconditionFailedException(statusDescription);
break;
case REQUEST_ENTITY_TOO_LARGE:
transportException = new RequestEntityTooLargeException(statusDescription);
break;
case THROTTLED:
transportException = new ThrottledException(statusDescription);
break;
case INTERNAL_SERVER_ERROR:
transportException = new InternalServerErrorException(statusDescription);
break;
case SERVER_BUSY:
transportException = new ServerBusyException(statusDescription);
break;
case ERROR:
transportException = new ServiceUnknownException("Service gave unknown status code: " + statusCode);
break;
default:
transportException = new IotHubServiceException("Service gave unknown status code: " + statusCode);
}
return transportException;
}