Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing properties to OpenApiException #222

Merged
merged 2 commits into from
May 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
]
},
"fantomas": {
"version": "6.0.1",
"version": "6.0.3",
"commands": [
"fantomas"
]
}
}
}
}
1 change: 0 additions & 1 deletion .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
pull_request:
branches:
- master
- net5

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ GITHUB
src/ProvidedTypes.fs (b7c930b0bd9e0e0476981ba0813ac17e7d61742b)
src/ProvidedTypes.fsi (b7c930b0bd9e0e0476981ba0813ac17e7d61742b)
remote: fsprojects/FSharp.Data
src/FSharp.Data.Runtime.Utilities/NameUtils.fs (ef2eda4cb33386335e25d03e694668b0af6f0945)
src/FSharp.Data.Runtime.Utilities/Pluralizer.fs (ef2eda4cb33386335e25d03e694668b0af6f0945)
src/FSharp.Data.Runtime.Utilities/NameUtils.fs (bbe54edc63a2d1ca3616f3b847ee34c0a88f91f2)
src/FSharp.Data.Runtime.Utilities/Pluralizer.fs (bbe54edc63a2d1ca3616f3b847ee34c0a88f91f2)
GROUP Server
RESTRICTION: == net6.0
NUGET
Expand Down
6 changes: 4 additions & 2 deletions src/SwaggerProvider.Runtime/ProvidedApiClientBase.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ open System.Threading.Tasks
open System.Text.Json
open System.Text.Json.Serialization

type OpenApiException(code: int, description: string) =
type OpenApiException(code: int, description: string, headers: Headers.HttpResponseHeaders, content: HttpContent) =
inherit Exception(description)
member _.StatusCode = code
member _.Description = description
member _.Headers = headers
member _.Content = content

type ProvidedApiClientBase(httpClient: HttpClient, options: JsonSerializerOptions) =

Expand Down Expand Up @@ -48,7 +50,7 @@ type ProvidedApiClientBase(httpClient: HttpClient, options: JsonSerializerOption
|> Array.tryFindIndex((=) codeStr)
|> Option.iter(fun idx ->
let desc = errorDescriptions[idx]
raise(OpenApiException(code, desc)))
raise(OpenApiException(code, desc, response.Headers, response.Content)))

// fail with HttpRequestException if we do not know error description
return response.EnsureSuccessStatusCode().Content
Expand Down
4 changes: 2 additions & 2 deletions tests/SwaggerProvider.Tests/paket.references
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group Test
FSharp.Core
Microsoft.NET.Test.Sdk
FSharp.SystemTextJson
FsUnit.xUnit
Microsoft.NET.Test.Sdk
Microsoft.OpenApi.Readers
System.Text.Json
FSharp.SystemTextJson
5 changes: 3 additions & 2 deletions tests/Swashbuckle.WebApi.Server/paket.references
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
group Server
FSharp.Core
Microsoft.AspNetCore
Microsoft.AspNetCore.Mvc
Microsoft.AspNetCore.HttpsPolicy
Swashbuckle.AspNetCore
Microsoft.OpenApi
FSharp.Core
Swashbuckle.AspNetCore
System.Text.Json