Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 Copyright 2010 Google Inc | 2 Copyright 2010 Google Inc |
class
2013/09/21 03:12:10
(Optional) Update copyright date?
peleyal
2013/09/23 12:01:16
As I understood from David (davidwaters) who owned
| |
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.Net; | 18 using System.Net; |
19 | 19 |
20 using Google.Apis.Requests; | 20 using Google.Apis.Requests; |
21 using Google.Apis.Util; | 21 using Google.Apis.Util; |
22 | 22 |
23 namespace Google | 23 namespace Google |
24 { | 24 { |
25 /// <summary> | 25 /// <summary>Represents an exception thrown by an API Service.</summary> |
26 /// Represents an exception thrown by an API Service. | |
27 /// </summary> | |
28 public class GoogleApiException : Exception | 26 public class GoogleApiException : Exception |
29 { | 27 { |
30 private readonly string serviceName; | 28 private readonly string serviceName; |
31 | 29 |
32 /// <summary> | 30 /// <summary>Gets the service name which related to this exception.</sum mary> |
33 /// Gets the service name which related to this exception. | |
34 /// </summary> | |
35 public string ServiceName | 31 public string ServiceName |
36 { | 32 { |
37 get { return serviceName; } | 33 get { return serviceName; } |
38 } | 34 } |
39 | 35 |
40 /// <summary> | 36 /// <summary>Creates an API Service exception.</summary> |
41 /// Creates an API Service exception. | |
42 /// </summary> | |
43 public GoogleApiException(string serviceName, string message, Exception inner) | 37 public GoogleApiException(string serviceName, string message, Exception inner) |
44 : base(message, inner) | 38 : base(message, inner) |
45 { | 39 { |
46 serviceName.ThrowIfNull("serviceName"); | 40 serviceName.ThrowIfNull("serviceName"); |
47 this.serviceName = serviceName; | 41 this.serviceName = serviceName; |
48 } | 42 } |
49 | 43 |
50 /// <summary> | 44 /// <summary>Creates an API Service exception.</summary> |
51 /// Creates an API Service exception | |
52 /// </summary> | |
53 public GoogleApiException(string serviceName, string message) : this(ser viceName, message, null) { } | 45 public GoogleApiException(string serviceName, string message) : this(ser viceName, message, null) { } |
54 | 46 |
55 /// <summary> | 47 /// <summary>The HTTP status code which was returned along with this err or, or 0 if unavailable.</summary> |
56 /// The http status code which was returned along with this error, | |
57 /// or 0 if unavailable. | |
58 /// </summary> | |
59 public HttpStatusCode HttpStatusCode { get; set; } | 48 public HttpStatusCode HttpStatusCode { get; set; } |
60 | 49 |
61 public override string ToString() | 50 public override string ToString() |
62 { | 51 { |
63 return string.Format("The service {1} has thrown an exception: {0}", base.ToString(), serviceName); | 52 return string.Format("The service {1} has thrown an exception: {0}", base.ToString(), serviceName); |
64 } | 53 } |
65 } | 54 } |
66 } | 55 } |
OLD | NEW |