I use the SFDC mobile sdk for android, and i can't get the server error response details (only 400 error) which is limited,
public void sfInsert(final Context context, final RestClient client, final Activity launcherActivity) throws UnsupportedEncodingException, IOException, JSONException {
RestRequest restRequest;
String api = context.getResources().getString(R.string.api_version);
if(Util.isNull(getId())) {
restRequest = RestRequest.getRequestForCreate(api, "DRX__c", ModelsUtils.getHashMap(this.asJSONObject(), doNotInsert));
client.sendAsync(restRequest, new AsyncRequestCallback() {
@Override
public void onSuccess(RestRequest request, RestResponse response) {
Util.toast("Insert success !");
// success case
}
@Override
public void onError(Exception e) {
/**
* HERE : rather than saying Insert error,i'd rather show the user the actual error happening in the server (validation rules, data privacy issues and so on.
*/
Util.toast("Insert error.");
e.printStackTrace();
}
});
}
rather than saying Insert error,i'd rather show the user the actual error happening in the server (validation rules, data privacy issues and so on.