|
|
@@ -18,10 +18,7 @@ import org.apache.logging.log4j.Logger;
|
|
|
|
|
|
import java.lang.reflect.Type;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import static cz.senslog.connector.http.HttpHeader.AUTHORIZATION;
|
|
|
import static cz.senslog.connector.json.BasicJson.jsonToObject;
|
|
|
@@ -120,6 +117,9 @@ public class AzureFetcher implements ConnectorFetcher<AzureModel> {
|
|
|
logger.info("Received a response with a status: {}.", response.getStatus());
|
|
|
|
|
|
if (response.isError()) {
|
|
|
+ Type mapType = new TypeToken<HashMap<String, String>>() {}.getType();
|
|
|
+ Map<String, String> responseBody = jsonToObject(response.getBody(), mapType);
|
|
|
+ logger.error(responseBody.getOrDefault("Message", "unknown error"));
|
|
|
throw logger.throwing(new Exception(format(
|
|
|
"Can not get information about the sensors. %s", response.getBody()
|
|
|
)));
|