Skip to content

Commit

Permalink
Improvement of design-time error handling (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorium authored Jan 23, 2025
1 parent c5c2114 commit fc7ee54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ NUGET
YamlDotNet (16.3)
GITHUB
remote: fsprojects/FSharp.TypeProviders.SDK
src/ProvidedTypes.fs (b965f9485545d308ced1cde3779c9e66a2a298f2)
src/ProvidedTypes.fsi (b965f9485545d308ced1cde3779c9e66a2a298f2)
src/ProvidedTypes.fs (dc8c662ca2e7d8d11048968ca166df6dc2fd9482)
src/ProvidedTypes.fsi (dc8c662ca2e7d8d11048968ca166df6dc2fd9482)
remote: fsprojects/FSharp.Data
src/FSharp.Data.Runtime.Utilities/NameUtils.fs (09165171f0c4a5e322bd47317f809bd771f5be49)
src/FSharp.Data.Runtime.Utilities/Pluralizer.fs (09165171f0c4a5e322bd47317f809bd771f5be49)
Expand Down
10 changes: 10 additions & 0 deletions src/SwaggerProvider.DesignTime/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ module SchemaReader =

match res with
| Choice1Of2 x -> return x
| Choice2Of2(:? Swagger.OpenApiException as ex) when not <| isNull ex.Content ->
let content =
ex.Content.ReadAsStringAsync()
|> Async.AwaitTask
|> Async.RunSynchronously

if String.IsNullOrEmpty content then
return ex.Reraise()
else
return content
| Choice2Of2(:? WebException as wex) when not <| isNull wex.Response ->
use stream = wex.Response.GetResponseStream()
use reader = new StreamReader(stream)
Expand Down

0 comments on commit fc7ee54

Please sign in to comment.