Error handling and fixes
This commit is contained in:
		| @@ -1061,6 +1061,16 @@ namespace VisaApiClient | ||||
|                             throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 409) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Conflict", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); | ||||
|                             throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); | ||||
| @@ -1212,9 +1222,9 @@ namespace VisaApiClient | ||||
|         /// </remarks> | ||||
|         /// <returns>Success</returns> | ||||
|         /// <exception cref="ApiException">A server side error occurred.</exception> | ||||
|         public virtual System.Threading.Tasks.Task<System.Collections.Generic.ICollection<VisaApplicationPreview>> GetForApplicantAsync() | ||||
|         public virtual System.Threading.Tasks.Task<System.Collections.Generic.ICollection<VisaApplicationPreview>> GetApplicationsForApplicantAsync() | ||||
|         { | ||||
|             return GetForApplicantAsync(System.Threading.CancellationToken.None); | ||||
|             return GetApplicationsForApplicantAsync(System.Threading.CancellationToken.None); | ||||
|         } | ||||
|  | ||||
|         /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> | ||||
| @@ -1226,7 +1236,7 @@ namespace VisaApiClient | ||||
|         /// </remarks> | ||||
|         /// <returns>Success</returns> | ||||
|         /// <exception cref="ApiException">A server side error occurred.</exception> | ||||
|         public virtual async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<VisaApplicationPreview>> GetForApplicantAsync(System.Threading.CancellationToken cancellationToken) | ||||
|         public virtual async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<VisaApplicationPreview>> GetApplicationsForApplicantAsync(System.Threading.CancellationToken cancellationToken) | ||||
|         { | ||||
|             var client_ = _httpClient; | ||||
|             var disposeClient_ = false; | ||||
| @@ -1275,16 +1285,6 @@ namespace VisaApiClient | ||||
|                             return objectResponse_.Object; | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 401) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
| @@ -1295,6 +1295,16 @@ namespace VisaApiClient | ||||
|                             throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 404) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
| @@ -1393,14 +1403,14 @@ namespace VisaApiClient | ||||
|                             return; | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         if (status_ == 400) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                             throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 401) | ||||
| @@ -1413,6 +1423,16 @@ namespace VisaApiClient | ||||
|                             throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 404) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
| @@ -1423,16 +1443,6 @@ namespace VisaApiClient | ||||
|                             throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 400) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); | ||||
|                             throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); | ||||
| @@ -1522,14 +1532,14 @@ namespace VisaApiClient | ||||
|                             return; | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         if (status_ == 400) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                             throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 401) | ||||
| @@ -1542,6 +1552,16 @@ namespace VisaApiClient | ||||
|                             throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 404) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
| @@ -1552,16 +1572,6 @@ namespace VisaApiClient | ||||
|                             throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 400) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); | ||||
|                             throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); | ||||
| @@ -1657,16 +1667,6 @@ namespace VisaApiClient | ||||
|                             return; | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 401) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
| @@ -1677,6 +1677,16 @@ namespace VisaApiClient | ||||
|                             throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 404) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
| @@ -1687,6 +1697,16 @@ namespace VisaApiClient | ||||
|                             throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 409) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Conflict", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); | ||||
|                             throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user