[client] detect when resource is not available
This commit is contained in:
parent
7a789c5e66
commit
a1149cdab4
@ -35,6 +35,10 @@ public class Main {
|
|||||||
CoapResponse response = null;
|
CoapResponse response = null;
|
||||||
try {
|
try {
|
||||||
response = client.get();
|
response = client.get();
|
||||||
|
if (!response.isSuccess()) {
|
||||||
|
System.err.println("[E] can not access resource");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
} catch (ConnectorException | IOException e) {
|
} catch (ConnectorException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user