[client] detect when resource is not available

This commit is contained in:
giomba 2019-11-16 16:34:22 +01:00
parent 7a789c5e66
commit a1149cdab4

View File

@ -35,6 +35,10 @@ public class Main {
CoapResponse response = null;
try {
response = client.get();
if (!response.isSuccess()) {
System.err.println("[E] can not access resource");
System.exit(1);
}
} catch (ConnectorException | IOException e) {
e.printStackTrace();
System.exit(1);