package it.integry.integrywmsnative.core.REST;

import android.util.Log;

import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.util.List;

import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
import it.integry.integrywmsnative.core.REST.model.EsitoType;
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityString;
import retrofit2.Response;

/**
 * Created by GiuseppeS on 22/03/2018.
 */

public class CommonRESTException {


    public static String tryRecognizeThenGetMessage(Exception ex){

        if(ex instanceof SocketException){
            return "Errore di comunicazione con il server remoto. Riprova.";
        } else if(ex instanceof SocketTimeoutException){
            return "Errore di timeout durante la comunicazione con il server remoto. Riprova.";
        } else if(ex.getMessage().startsWith("Printer not found")){
            return "Stampante non trovata";
        } else {
            return ex.getMessage();
        }

    }

}
