Hi,

I have an app that saves vital information in a local database (within the 
mobile). I apply all the business rules to local data and if I have a data 
connection I send them to a server through the rest full API. The database 
is on an external server, but I have the app and the webservice in test 
mode on my computer. Simulate that I lost the data connection considering 
that the "getResponseCode" method would return the error 500 and allow me 
to continue, on the contrary, it shows me an error window with the options 
to retry and cancel. My intention is that the app continues to work in the 
event of any communication or server error. Should I put in a "try" 
statement to catch the error, or is there another way? Example method:

    public static void adicionaVisita(Visita v) {
        Response<String> r = VisitaService.adicion(v);
        if (r.getResponseCode() == 200) {
            procesaRegistro(v, MODO_ELIMINA);
            v.visitaId.set(Long.parseLong(r.getResponseData()));
            v.modoPendiente.set(0);
            procesaRegistro(v, MODO_ADICION);
        }
    }

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/9bb8249a-f1c3-4099-b705-a3f7580f9c71o%40googlegroups.com.

Reply via email to