Search in sources :

Example 1 with NetworkNotFoundException

use of com.spotify.docker.client.exceptions.NetworkNotFoundException in project docker-client by spotify.

the class DefaultDockerClient method removeNetwork.

@Override
public void removeNetwork(String networkId) throws DockerException, InterruptedException {
    try {
        final WebTarget resource = resource().path("networks").path(networkId);
        request(DELETE, resource, resource.request(APPLICATION_JSON_TYPE));
    } catch (DockerRequestException e) {
        switch(e.status()) {
            case 404:
                throw new NetworkNotFoundException(networkId, e);
            default:
                throw e;
        }
    }
}
Also used : DockerRequestException(com.spotify.docker.client.exceptions.DockerRequestException) WebTarget(javax.ws.rs.client.WebTarget) NetworkNotFoundException(com.spotify.docker.client.exceptions.NetworkNotFoundException)

Aggregations

DockerRequestException (com.spotify.docker.client.exceptions.DockerRequestException)1 NetworkNotFoundException (com.spotify.docker.client.exceptions.NetworkNotFoundException)1 WebTarget (javax.ws.rs.client.WebTarget)1