2
votes

How can I catch an HTTP 404 error using the Terse REST API in CodenameOne? At the moment the default error handler gets this but I would like to display my own message instead. The code I am using is fine if the accountNo exists and I can deal with the resulting JSON, but if not I get the standard error handler displaying the 404 error:

Response<Map> jsonData = Rest.get( URL + "lookup").
          jsonContent().
          queryParam("account",accountNo).
          getAsJsonMap();
1

1 Answers

1
votes

This seems to be a mistake in that version of the method. It should fail silently without a UI Dialog. We'll fix it for the next update.

Notice that jsonData should have the error response code within it as jsonData.getResponseCode().