if (reason != null) { GoogleJsonError.ErrorInfo errorInfo = jsonError.getErrors().get(0); location = errorInfo.getLocation(); debugInfo = (String) errorInfo.get("debugInfo");
private static ExceptionData makeExceptionData( GoogleJsonError googleJsonError, boolean idempotent, Set<BaseServiceException.Error> retryableErrors) { int code = googleJsonError.getCode(); String reason = reason(googleJsonError); ExceptionData.Builder exceptionData = ExceptionData.newBuilder(); exceptionData .setMessage(googleJsonError.getMessage()) .setCause(null) .setRetryable(BaseServiceException.isRetryable(code, reason, idempotent, retryableErrors)) .setCode(code) .setReason(reason); if (reason != null) { GoogleJsonError.ErrorInfo errorInfo = googleJsonError.getErrors().get(0); exceptionData.setLocation(errorInfo.getLocation()); exceptionData.setDebugInfo((String) errorInfo.get("debugInfo")); } else { exceptionData.setLocation(null); exceptionData.setDebugInfo(null); } return exceptionData.build(); }
public BaseServiceException(IOException exception, boolean idempotent) { super(message(exception), exception); int code = UNKNOWN_CODE; String reason = null; String location = null; String debugInfo = null; Boolean retryable = null; if (exception instanceof GoogleJsonResponseException) { GoogleJsonError jsonError = ((GoogleJsonResponseException) exception).getDetails(); if (jsonError != null) { Error error = new Error(jsonError.getCode(), reason(jsonError)); code = error.code; reason = error.reason; retryable = isRetryable(idempotent, error); if (reason != null) { GoogleJsonError.ErrorInfo errorInfo = jsonError.getErrors().get(0); location = errorInfo.getLocation(); debugInfo = (String) errorInfo.get("debugInfo"); } } else { code = ((GoogleJsonResponseException) exception).getStatusCode(); } } this.retryable = MoreObjects.firstNonNull(retryable, isRetryable(idempotent, exception)); this.code = code; this.reason = reason; this.idempotent = idempotent; this.location = location; this.debugInfo = debugInfo; }
if (reason != null) { GoogleJsonError.ErrorInfo errorInfo = jsonError.getErrors().get(0); location = errorInfo.getLocation(); debugInfo = (String) errorInfo.get("debugInfo");
private static ExceptionData makeExceptionData( GoogleJsonError googleJsonError, boolean idempotent, Set<BaseServiceException.Error> retryableErrors) { int code = googleJsonError.getCode(); String reason = reason(googleJsonError); ExceptionData.Builder exceptionData = ExceptionData.newBuilder(); exceptionData .setMessage(googleJsonError.getMessage()) .setCause(null) .setRetryable(BaseServiceException.isRetryable(code, reason, idempotent, retryableErrors)) .setCode(code) .setReason(reason); if (reason != null) { GoogleJsonError.ErrorInfo errorInfo = googleJsonError.getErrors().get(0); exceptionData.setLocation(errorInfo.getLocation()); exceptionData.setDebugInfo((String) errorInfo.get("debugInfo")); } else { exceptionData.setLocation(null); exceptionData.setDebugInfo(null); } return exceptionData.build(); }
public BaseServiceException(GoogleJsonError googleJsonError, boolean idempotent) { super(googleJsonError.getMessage()); Error error = new Error(googleJsonError.getCode(), reason(googleJsonError)); this.code = error.code; this.reason = error.reason; this.retryable = isRetryable(idempotent, error); if (this.reason != null) { GoogleJsonError.ErrorInfo errorInfo = googleJsonError.getErrors().get(0); this.location = errorInfo.getLocation(); this.debugInfo = (String) errorInfo.get("debugInfo"); } else { this.location = null; this.debugInfo = null; } this.idempotent = idempotent; }