Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiException"/> class.
 /// </summary>
 /// <param name="statusCode">The status code.</param>
 /// <param name="apiError">The API error.</param>
 public ApiException(HttpStatusCode statusCode, ApiError apiError)
     : base(apiError == null ? statusCode.ToString() : apiError.Message)
 {
     StatusCode = statusCode;
     ApiError   = apiError;
 }
 internal static async Task <ErrorApiException> CreateAsync(HttpResponseMessage response)
 {
     return(new ErrorApiException(response.StatusCode, await ApiError.Parse(response).ConfigureAwait(false)));
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RateLimitApiException"/> class with a specified <paramref name="rateLimit"/>.
 /// </summary>
 /// <param name="rateLimit"><see cref="Exceptions.RateLimit"/> received on the API call that failed.</param>
 /// <param name="apiError"><see cref="Exceptions.ApiError"/> received on the API call that failed.</param>
 public RateLimitApiException(RateLimit rateLimit, ApiError apiError = null)
     : this("Rate limits exceeded")
 {
     RateLimit = rateLimit;
     ApiError  = apiError;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiException"/> class with a specified
 /// <paramref name="statusCode"/> and optional <paramref name="apiError"/>.
 /// </summary>
 /// <param name="statusCode"><see cref="HttpStatusCode"/>code of the failing API call.</param>
 /// <param name="apiError">Optional <see cref="ApiError"/> of the failing API call.</param>
 public ErrorApiException(HttpStatusCode statusCode, ApiError apiError = null)
     : this(apiError == null ? statusCode.ToString() : apiError.Message)
 {
     StatusCode = statusCode;
     ApiError   = apiError;
 }