@Override public StorageError body() { return (StorageError) super.body(); } }
/** * @return The status code on the response. */ public int statusCode() { return super.response().statusCode(); } }
@Override public HttpResponse apply(String bodyString) throws Exception { try { Object body = deserializeBody(bodyString, getEntityType(), returnValueWireType, SerializerEncoding.fromHeaders(response.headers())); return bufferedResponse .withDeserializedHeaders(deserializedHeaders) .withDeserializedBody(body); } catch (JsonParseException e) { throw new RestException("HTTP response has a malformed body", response, e); } } });
@Override public String toString() { String message = super.toString(); if (body() != null && body().message() != null) { message = message + ": " + body().message(); } return message; } }
asyncResult = asyncResult.toCompletable().andThen(Single.error(new RestException( "No deserialized headers were found. Please add a DecodingPolicyFactory to the HttpPipeline.", response,
/** * @return The status code on the response. */ public int statusCode() { return super.response().statusCode(); } }
@Override public StorageError body() { return (StorageError) super.body(); } }
deserializedHeaders = deserializeHeaders(response.headers()); } catch (IOException e) { return Single.error(new RestException("HTTP response has malformed headers", response, e)); .withDeserializedBody(body); } catch (JsonParseException e) { throw new RestException("HTTP response has a malformed body", response, e);
/** * @return The error code returned by the service. */ public StorageErrorCode errorCode() { return StorageErrorCode.fromString(super.response().headers().value(Constants.HeaderConstants.ERROR_CODE)); }
@Override public CloudError body() { return (CloudError) super.body(); }
asyncResult = Maybe.just(response.body()); } else if (!response.isDecoded()) { asyncResult = Maybe.error(new RestException( "No deserialized response body was found. Please add a DecodingPolicyFactory to the HttpPipeline.", response,
/** * @return The error code returned by the service. */ public StorageErrorCode errorCode() { return StorageErrorCode.fromString(super.response().headers().value(Constants.HeaderConstants.ERROR_CODE)); }
public static void createContainer(ContainerURL containerURL, String containerName) { logInfo("Start creating container %s...", containerName); try { final ContainerCreateResponse response = containerURL.create(null, null, null).blockingGet(); logInfo("Storage container %s created with status code: %s.", containerName, response.statusCode()); } catch (RestException e) { if (e.response().statusCode() != 409) { logError("Failed to create container %s.", containerName, e); throw e; } else { logInfo("%s container already exists.", containerName); } } }