Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(892)

Side by Side Diff: Src/GoogleApis/Apis/Http/IHttpExceptionHandler.cs

Issue 13412046: Reimplement OAuth2 library - Step 1 (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: minor Created 10 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Copyright 2013 Google Inc 2 Copyright 2013 Google Inc
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at 6 You may obtain a copy of the License at
7 7
8 http://www.apache.org/licenses/LICENSE-2.0 8 http://www.apache.org/licenses/LICENSE-2.0
9 9
10 Unless required by applicable law or agreed to in writing, software 10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS, 11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and 13 See the License for the specific language governing permissions and
14 limitations under the License. 14 limitations under the License.
15 */ 15 */
16 16
17 using System; 17 using System;
18 using System.Collections.Generic;
19 using System.Linq;
20 using System.Net.Http; 18 using System.Net.Http;
21 using System.Text;
22 using System.Threading; 19 using System.Threading;
20 using System.Threading.Tasks;
23 21
24 namespace Google.Apis.Http 22 namespace Google.Apis.Http
25 { 23 {
26 /// <summary> Argument class to <see cref="IHttpExceptionHandler.HandleExcep tion"/>.</summary> 24 /// <summary>Argument class to <see cref="IHttpExceptionHandler.HandleExcept ionAsync"/>.</summary>
27 public class HandleExceptionArgs 25 public class HandleExceptionArgs
28 { 26 {
29 /// <summary> Gets or sets the sent request.</summary> 27 /// <summary>Gets or sets the sent request.</summary>
30 public HttpRequestMessage Request { get; set; } 28 public HttpRequestMessage Request { get; set; }
31 29
32 /// <summary> Gets or sets the exception which occurred during sending t he request.</summary> 30 /// <summary>Gets or sets the exception which occurred during sending th e request.</summary>
33 public Exception Exception { get; set; } 31 public Exception Exception { get; set; }
34 32
35 /// <summary> Gets or sets the total number of tries to send the request .</summary> 33 /// <summary>Gets or sets the total number of tries to send the request. </summary>
36 public int TotalTries { get; set; } 34 public int TotalTries { get; set; }
37 35
38 /// <summary> Gets or sets the current failed try.</summary> 36 /// <summary>Gets or sets the current failed try.</summary>
39 public int CurrentFailedTry { get; set; } 37 public int CurrentFailedTry { get; set; }
40 38
41 /// <summary> Gets whether there will actually be a retry if the handler returns <c>true</c>.</summary> 39 /// <summary>Gets whether there will actually be a retry if the handler returns <c>true</c>.</summary>
42 public bool SupportsRetry 40 public bool SupportsRetry
43 { 41 {
44 get { return TotalTries - CurrentFailedTry > 0; } 42 get { return TotalTries - CurrentFailedTry > 0; }
45 } 43 }
46 44
47 /// <summary> Gets and sets the cancellation token which belongs to the request.</summary> 45 /// <summary>Gets and sets the cancellation token which belongs to the r equest.</summary>
48 public CancellationToken CancellationToken { get; set; } 46 public CancellationToken CancellationToken { get; set; }
49 } 47 }
50 48
51 /// <summary> 49 /// <summary>
52 /// Exception handler which is invoked when an exception is thrown during an Http request. 50 /// Exception handler which is invoked when an exception is thrown during a HTTP request.
53 /// </summary> 51 /// </summary>
54 public interface IHttpExceptionHandler 52 public interface IHttpExceptionHandler
55 { 53 {
56 /// <summary> 54 /// <summary>
57 /// Handles an exception thrown when sending an Http request.· 55 /// Handles an exception thrown when sending a HTTP request.·
58 /// A simple rule must be followed, if you modify the request object in a way that the exception can be· 56 /// A simple rule must be followed, if you modify the request object in a way that the exception can be·
59 /// resolved, you must return <c>true</c>. 57 /// resolved, you must return <c>true</c>.
60 /// </summary> 58 /// </summary>
61 /// <param name="args"> 59 /// <param name="args">
62 /// Handle exception argument which contains properties like the request , the exception, current failed try. 60 /// Handle exception argument which contains properties like the request , the exception, current failed try.
63 /// </param> 61 /// </param>
64 /// <returns>Whether or not this handler has made a change that will req uire the request to be resent</returns> 62 /// <returns>Whether or not this handler has made a change that will req uire the request to be resent</returns>
65 bool HandleException(HandleExceptionArgs args); 63 Task<bool> HandleExceptionAsync(HandleExceptionArgs args);
66 } 64 }
67 } 65 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b