private static void jsonErrorHandling(JSONObject response,Exception e,JSONParserInterface parser){
  if (parser == null || response == null)   return;
  String message="";
  if (response.has(DomoticzValues.Json.Field.MESSAGE)) {
    try {
      message=response.getString(DomoticzValues.Json.Field.MESSAGE);
    }
 catch (    JSONException e1) {
      e1.printStackTrace();
    }
  }
  Exception exNew;
  if (e != null && !UsefulBits.isEmpty(e.getMessage())) {
    exNew=new Exception("Failed: " + message + " - "+ e.getMessage());
  }
 else {
    exNew=new Exception("Failed: " + message);
  }
  Log.e(TAG,exNew.getMessage());
  if (parser != null)   parser.onError(exNew);
}

private static void jsonErrorHandling ( JSONObject response , Exception e , JSONParserInterface parser ) { if ( parser == null || response == null ) return ; String message = "" ; if ( response . has ( DomoticzValues . Json . Field . MESSAGE ) ) { try { message = response . getString ( DomoticzValues . Json . Field . MESSAGE ) ; } catch ( JSONException e1 ) { e1 . printStackTrace ( ) ; } } Exception exNew ; if ( e != null && ! UsefulBits . isEmpty ( e . getMessage ( ) ) ) { exNew = new Exception ( "Failed: " + message + " - " + e . getMessage ( ) ) ; } else { exNew = new Exception ( "Failed: " + message ) ; } Log . e ( TAG , exNew . getMessage ( ) ) ; if ( parser != null ) parser . onError ( exNew ) ; }
handle json errors ( functional errors )
