Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Handle API failures when not connected to the internet #84

Open
teocomi opened this issue Jul 23, 2018 · 1 comment
Open

Handle API failures when not connected to the internet #84

teocomi opened this issue Jul 23, 2018 · 1 comment

Comments

@teocomi
Copy link
Member

teocomi commented Jul 23, 2018

Should probably throw an exception when no internet is available or the API cannot be reached. If the call below fails there is not catch to handle it:

var response_ = await client_.SendAsync( request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken ).ConfigureAwait( false );

@didimitrie
Copy link
Member

I would see the easiest way to fix this via an InternetAccess flag which can be checked in the PrepareRequest and execeptions thrown. https://github.com/speckleworks/SpeckleCore/blob/master/SpeckleCore/SpeckleApiClientHead.cs#L58

I'm hesitant to change the autogenerated code, as it will make subsequent future generations more painful. But if nswag can be coerced into adding that catch, i'm fine :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants