ksch-workflows / jfx-prototype

Mozilla Public License 2.0
0 stars 0 forks source link

Missing error handling for OpenMRS not available #1

Open jmewes opened 6 years ago

jmewes commented 6 years ago

If OpenMRS is not available, currently the screen will just hang and then there will be a stacktrace with a timeout error on the terminal.

$ java -jar ./build/jfx/app/project-jfx.jar
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: Error on attempt to do GET request on https://ksch/openmrs/ws/rest/v1/patient?identifier=Doe
    at com.experimental.openmrs.OpenMRS.get(OpenMRS.java:43)
    at com.experimental.openmrs.resources.PatientResource.findByNameOrId(PatientResource.java:17)
    at io.github.kschworkflows.services.PatientServiceImpl.findPatients(PatientServiceImpl.java:18)
    at io.github.kschworkflows.ui.RegistrationPage.<init>(RegistrationPage.java:23)
    ...
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to ksch:443 [ksch/192.168.1.6] failed: connect timed out
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:150)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:138)
...