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

Webexception handling, possible fix for #132 #159

Closed
wants to merge 4 commits into from

Conversation

Thorium
Copy link
Member

@Thorium Thorium commented Jun 7, 2020

Reading the response body of non-ok web-request.
This could help for #132
My request didn't actually fail, so needs testing.

SwaggerProvider.Internal.SchemaReader.readSchemaPath "" filePath
|> Async.RunSynchronously

failwith "External definition of this path item is not supported yet"
Copy link
Member

@sergey-tihon sergey-tihon Jun 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Thorium few questions here

  1. Why to use basePath instead of schemaPathRaw? I would expect that $ref if relative to schema rather than API base path
  2. What is point to request schema before raising exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, with this commit was an earlier commit for the other PR #152
and with that I the failwith is still the old code, the Parsers.fs changes can be ignored.

else err.ToString()
| Choice2Of2 e -> return failwith(e.ToString())
| false ->
return schemaPathRaw |> IO.File.ReadAllText
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this line is inside async we can replace in by

use sr = new StreamReader(schemaPathRaw)
return! sr.ReadToEndAsync() |> Async.AwaitTask

@Thorium
Copy link
Member Author

Thorium commented Jun 7, 2020

I'll close this and redo the PR.

@Thorium Thorium closed this Jun 7, 2020
@Thorium Thorium deleted the webexception-handling branch June 8, 2020 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants