in src/Microsoft.Azure.Relay/ManagementOperations.cs [122:151]
static async Task<Exception> CreateExceptionForFailedResponseAsync(HttpResponseMessage httpResponse)
{
string detail = await ExtractErrorDetailFromResponseAsync(httpResponse).ConfigureAwait(false);
if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
{
return new AuthorizationFailedException(detail);
}
else if (httpResponse.StatusCode == HttpStatusCode.Forbidden)
{
return new QuotaExceededException(detail);
}
else if (httpResponse.StatusCode == HttpStatusCode.NotFound || httpResponse.StatusCode == HttpStatusCode.NoContent)
{
return new EndpointNotFoundException(detail);
}
else if (httpResponse.StatusCode == HttpStatusCode.ServiceUnavailable)
{
return new ServerBusyException(detail);
}
else if (httpResponse.StatusCode == HttpStatusCode.InternalServerError)
{
return new RelayException(detail);
}
else if (httpResponse.StatusCode == HttpStatusCode.Conflict)
{
return new EndpointAlreadyExistsException(detail);
}
return new RelayException(detail);
}