@@ -120,7 +120,7 @@ public class HttpException : Exception
120120 /// <param name="message">The message.</param>
121121 /// <param name="uri">The request uri.</param>
122122 /// <param name="inner">The inner.</param>
123- public HttpException ( int statusCode , string message = null , Uri uri = null , Exception inner = null )
123+ internal HttpException ( int statusCode , string message = null , Uri uri = null , Exception inner = null )
124124 : base ( message , inner )
125125 {
126126 this . StatusCode = statusCode ;
@@ -154,7 +154,7 @@ public class BadInputException : HttpException
154154 /// </summary>
155155 /// <param name="message">The message that describes the error.</param>
156156 /// <param name="uri">The request URI.</param>
157- public BadInputException ( string message , Uri uri = null )
157+ internal BadInputException ( string message , Uri uri = null )
158158 : base ( 400 , message , uri )
159159 {
160160 }
@@ -170,7 +170,7 @@ public partial class AuthException
170170 /// </summary>
171171 /// <param name="message">The message that describes the error.</param>
172172 /// <param name="uri">The request URI</param>
173- [ Obsolete ( "This constructor will be removed soon." ) ]
173+ [ Obsolete ( "This constructor will be removed soon." ) ]
174174 public AuthException ( string message , Uri uri = null ) : base ( null , message )
175175 {
176176 this . StatusCode = 401 ;
@@ -197,23 +197,22 @@ public AuthException(string message, Uri uri = null) : base(null, message)
197197 }
198198
199199 /// <summary>
200- /// An HTTP Exception that will cause a retry
200+ /// An HTTP Exception that will cause a retry due to transient failure. The SDK will perform
201+ /// a certain number of retries which is configurable in <see cref="DropboxClient"/>. If the client
202+ /// still gets this exception, it's up to the client to decide whether to continue retrying or not.
201203 /// </summary>
202204 public class RetryException : HttpException
203205 {
204206 /// <summary>
205207 /// Initializes a new instance of the <see cref="RetryException"/> class.
206208 /// </summary>
207209 /// <param name="statusCode">The status code.</param>
208- /// <param name="isRateLimit">if set to <c>true</c> the server responded with
209- /// an error indicating rate limiting.</param>
210210 /// <param name="message">The message.</param>
211211 /// <param name="uri">The request URI.</param>
212212 /// <param name="inner">The inner.</param>
213- public RetryException ( int statusCode , bool isRateLimit = false , string message = null , Uri uri = null , Exception inner = null )
213+ internal RetryException ( int statusCode , string message = null , Uri uri = null , Exception inner = null )
214214 : base ( statusCode , message , uri , inner )
215215 {
216- this . IsRateLimit = isRateLimit ;
217216 }
218217
219218 /// <summary>
@@ -222,6 +221,48 @@ public RetryException(int statusCode, bool isRateLimit = false, string message =
222221 /// <value>
223222 /// <c>true</c> if this response is a rate limit; otherwise, <c>false</c>.
224223 /// </value>
225- public bool IsRateLimit { get ; private set ; }
224+ [ Obsolete ( "This field will be removed soon. Please catch RateLimitException separately." ) ]
225+ public virtual bool IsRateLimit
226+ {
227+ get { return false ; }
228+ }
229+ }
230+
231+ /// <summary>
232+ /// An HTTP Exception that will cause a retry due to rate limiting. The SDK will not do auto-retry for
233+ /// this type of exception. The client should do proper backoff based on the value of
234+ /// <see cref="RateLimitException.RetryAfter"/> field.
235+ /// </summary>
236+ public class RateLimitException : RetryException
237+ {
238+ /// <summary>
239+ /// Initializes a new instance of the <see cref="RateLimitException"/> class.
240+ /// </summary>
241+ /// <param name="retryAfter">The time in second which the client should retry after.</param>
242+ /// <param name="message">The message.</param>
243+ /// <param name="uri">The request URI.</param>
244+ /// <param name="inner">The inner.</param>
245+ internal RateLimitException ( int retryAfter , string message = null , Uri uri = null , Exception inner = null )
246+ : base ( 429 , message , uri , inner )
247+ {
248+ this . RetryAfter = retryAfter ;
249+ }
250+
251+ /// <summary>
252+ /// Gets the value in second which the client should backoff and retry after.
253+ /// </summary>
254+ public int RetryAfter { get ; private set ; }
255+
256+ /// <summary>
257+ /// Gets a value indicating whether this error represents a rate limiting response from the server.
258+ /// </summary>
259+ /// <value>
260+ /// <c>true</c> if this response is a rate limit; otherwise, <c>false</c>.
261+ /// </value>
262+ [ Obsolete ( "This field will be removed soon." ) ]
263+ public override bool IsRateLimit
264+ {
265+ get { return true ; }
266+ }
226267 }
227268}
0 commit comments