GraphHopper.com | Forum | GitHub | Maps | Blog

Client generated from swagger does not return detailed error message


#1

Currently swagger has the limitation that just the error code is returned and not the modelled error object - at least for the Java client, so you are not able to get the error details via this method. Luckily you can grab the raw response as well via apiException.getResponseBody().toString():

// for the correct usage please consult the most recent examples
try {
    
} catch (ApiException e) {
    // currently just a string is returned!
    String jsonString = e.getResponseBody().toString();
    // potentially parse the json and read hints
    throw new RuntimeException(jsonString);
}

#2

BTW: This is the corresponding issue for the swagger codegen.