All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.davidmoten.aws.lw.client.internal.ExceptionFactoryDefault Maven / Gradle / Ivy

Go to download

Lightweight client for all AWS services (but still with useful builders and XML parser)

The newest version!
package com.github.davidmoten.aws.lw.client.internal;

import java.nio.charset.StandardCharsets;
import java.util.Optional;

import com.github.davidmoten.aws.lw.client.ExceptionFactory;
import com.github.davidmoten.aws.lw.client.Response;
import com.github.davidmoten.aws.lw.client.ServiceException;

public class ExceptionFactoryDefault implements ExceptionFactory{

    @Override
    public Optional create(Response r) {
        if (r.isOk()) {
            return Optional.empty();
        } else {
            return Optional.of(new ServiceException(r.statusCode(),
                    new String(r.content(), StandardCharsets.UTF_8)));
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy