-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AIException, HttpRequestException, and RequestFailedException are rep…
…laced/wrapped by HttpOperationException.
- Loading branch information
1 parent
8feb1b1
commit 5e2742d
Showing
21 changed files
with
404 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
dotnet/src/Connectors/Connectors.AI.OpenAI/AzureSdk/RequestFailedExceptionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System.Net; | ||
using Azure; | ||
using Microsoft.SemanticKernel.Diagnostics; | ||
|
||
namespace Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk; | ||
|
||
/// <summary> | ||
/// Provides extension methods for the <see cref="RequestFailedException"/> class. | ||
/// </summary> | ||
public static class RequestFailedExceptionExtensions | ||
{ | ||
/// <summary> | ||
/// Converts a <see cref="RequestFailedException"/> to an <see cref="HttpOperationException"/>. | ||
/// </summary> | ||
/// <param name="original">The original <see cref="RequestFailedException"/> object.</param> | ||
/// <returns>An <see cref="HttpOperationException"/> instance.</returns> | ||
public static HttpOperationException ToHttpOperationException(this RequestFailedException original) | ||
{ | ||
const int NoResponseReceived = 0; | ||
|
||
return new HttpOperationException( | ||
original.Status == NoResponseReceived ? null : (HttpStatusCode?)original.Status, | ||
null, | ||
original.Message, | ||
original); | ||
} | ||
} |
Oops, something went wrong.