diff --git a/core/src/main/java/org/jclouds/rest/RateLimitExceededException.java b/core/src/main/java/org/jclouds/rest/RateLimitExceededException.java new file mode 100644 index 0000000000..83ab81d937 --- /dev/null +++ b/core/src/main/java/org/jclouds/rest/RateLimitExceededException.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.rest; + +/** + * Thrown when a request fails because the rate limit has been exceeded. + */ +public class RateLimitExceededException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public RateLimitExceededException() { + super(); + } + + public RateLimitExceededException(String message, Throwable cause) { + super(message, cause); + } + + public RateLimitExceededException(String message) { + super(message); + } + + public RateLimitExceededException(Throwable cause) { + super(cause); + } + +} diff --git a/core/src/main/java/org/jclouds/util/Throwables2.java b/core/src/main/java/org/jclouds/util/Throwables2.java index f59d0b372c..31c17c3a3e 100644 --- a/core/src/main/java/org/jclouds/util/Throwables2.java +++ b/core/src/main/java/org/jclouds/util/Throwables2.java @@ -27,6 +27,7 @@ import org.jclouds.concurrent.TransformParallelException; import org.jclouds.http.HttpResponseException; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.InsufficientResourcesException; +import org.jclouds.rest.RateLimitExceededException; import org.jclouds.rest.ResourceAlreadyExistsException; import org.jclouds.rest.ResourceNotFoundException; @@ -135,6 +136,7 @@ public class Throwables2 { ResourceAlreadyExistsException.class, ResourceNotFoundException.class, InsufficientResourcesException.class, + RateLimitExceededException.class, HttpResponseException.class); // Note this needs to be kept up-to-date with all top-level exceptions jclouds works against