Skip to content

Commit

Permalink
Added missing properties to OpenApiException (#222)
Browse files Browse the repository at this point in the history
* Updated Fantomas to 6.0.3

* Added missing properties to `OpenApiException`
  • Loading branch information
xperiandri authored May 27, 2023
1 parent 0c5f94c commit 6421a67
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
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

0 comments on commit 6421a67

Please sign in to comment.