B b4auser1 Well-Known Member Licensed User Longtime User Aug 5, 2017 #1 Code: Copy ' java.net.ConnectException: Failed to connect to /192.168.0.10:8000 ' at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:156) hc.ExecuteCredentials(job.GetRequest, taskCounter, job.Username, job.Password) When there is no network connection or there is a problem with network connection, OKHttpClient hc.ExecuteCredentials doesn't genertate event hc_ResponseError, but raises exception instead. Try catch construction doesn't intercept the exception.
Code: Copy ' java.net.ConnectException: Failed to connect to /192.168.0.10:8000 ' at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:156) hc.ExecuteCredentials(job.GetRequest, taskCounter, job.Username, job.Password) When there is no network connection or there is a problem with network connection, OKHttpClient hc.ExecuteCredentials doesn't genertate event hc_ResponseError, but raises exception instead. Try catch construction doesn't intercept the exception.
Erel B4X founder Staff member Licensed User Longtime User Aug 6, 2017 #2 1. Can you post the full error message from the logs? 2. Why aren't you using OkHttpUtils2?
B b4auser1 Well-Known Member Licensed User Longtime User Aug 6, 2017 #3 1. Can you post the full error message from the logs? Click to expand... I tried to reproduce error conditions, but failed. There is now exception in log "java.net.UnknownHostException: ...", and fortunately hc_ResponseError is raised with Reason = java.net.UnknownHostException. 2. Why aren't you using OkHttpUtils2? Click to expand... I took sources of OkHttpUtils2 and expanded them to save additionally f.e. Reason in HttpJob field. I have kept control flow.
1. Can you post the full error message from the logs? Click to expand... I tried to reproduce error conditions, but failed. There is now exception in log "java.net.UnknownHostException: ...", and fortunately hc_ResponseError is raised with Reason = java.net.UnknownHostException. 2. Why aren't you using OkHttpUtils2? Click to expand... I took sources of OkHttpUtils2 and expanded them to save additionally f.e. Reason in HttpJob field. I have kept control flow.
B b4auser1 Well-Known Member Licensed User Longtime User Aug 6, 2017 #4 Finally, I managed to reproduce error conditions (Network presensts, host is down) and got exception "java.net.ConnectException: Failed to connect to ...". And again, hc_ResponseError is raised with Reason = java.net.ConnectException: Failed to connect to. So there is no problem in library. It seems that I did something wrong in my code.
Finally, I managed to reproduce error conditions (Network presensts, host is down) and got exception "java.net.ConnectException: Failed to connect to ...". And again, hc_ResponseError is raised with Reason = java.net.ConnectException: Failed to connect to. So there is no problem in library. It seems that I did something wrong in my code.