public IOException getExceptionFromResponse()

in src/main/java/com/microsoft/azure/datalake/store/ADLStoreClient.java [1259:1292]


    public IOException getExceptionFromResponse(OperationResponse resp, String defaultMessage) {
        String messageSuffix = " [ServerRequestId:" + resp.requestId + "]";
        if (remoteExceptionsEnabled() &&
                resp.remoteExceptionJavaClassName !=null &&
                !resp.remoteExceptionJavaClassName.equals("")) {
            return getRemoteException(resp.remoteExceptionJavaClassName, resp.remoteExceptionMessage + messageSuffix);
        } else {
            String msg = resp.message == null ? defaultMessage : defaultMessage + "\n" + resp.message;
            if (resp.ex != null) {
                msg = msg + "\nOperation " + resp.opCode + " failed with exception " + resp.ex.getClass().getName() + " : " + resp.ex.getMessage();
            } else if (resp.httpResponseCode > 0) {
                msg = msg + "\nOperation " + resp.opCode + " failed with HTTP" + resp.httpResponseCode + " : " + resp.remoteExceptionName;
            }
            msg = msg +
                    "\nLast encountered exception thrown after " +
                    (resp.numRetries+1) +
                    " tries. ";
            if (resp.exceptionHistory != null) msg = msg + "[" + resp.exceptionHistory + "]";
            msg = msg + "\n" + messageSuffix;

            ADLException ex = new ADLException(msg);
            ex.httpResponseCode = resp.httpResponseCode;
            ex.httpResponseMessage = resp.httpResponseMessage;
            ex.requestId = resp.requestId;
            ex.numRetries = resp.numRetries;
            ex.lastCallLatency = resp.lastCallLatency;
            ex.responseContentLength = resp.responseContentLength;
            ex.remoteExceptionName = resp.remoteExceptionName;
            ex.remoteExceptionMessage = resp.remoteExceptionMessage;
            ex.remoteExceptionJavaClassName = resp.remoteExceptionJavaClassName;
            ex.initCause(resp.ex);
            return ex;
        }
    }