bsautner/com.nimbits

when I try to find point by name, nimbits throws an exception with 404 instead of Optional<Point> object.

Closed this issue · 4 comments

Exception in thread "main" retrofit.RetrofitError: 404 Not Found
at retrofit.RetrofitError.httpError(RetrofitError.java:40)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:388)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at com.sun.proxy.$Proxy20.findPoint(Unknown Source)
at com.nimbits.client.io.Nimbits.findPointByName(Nimbits.java:322)

Previously we were able to write a code like this

Optional<Point> point = nimbitsClient.findPointByName(pointName);
        if (!point.isPresent()) {
            LOGGER.info("No such point: " + pointName + ", for user: " + email);
            return null;
        }

but now it will crash with retrofit exception

i would just change our client to do a try/catch and return an optional.absent - i can put that in if you prefer - let me know

What about other entities? Are you going to wrap them the same way as datapoints? As I remember old nimbits versions wrap all entities into the Optional object, and now this functionality is lost.

sure i'll add it to the rest and run a build in an hour. 4.1.3 client will be published which is compatible with the the 4.1.2 server so you don't need to update the server. Let me know if you need anything else before i run a build

Could you upload a new nimbits_io to bintray, please?