desktop icon indicating copy to clipboard operation
desktop copied to clipboard

improve error handling of protected branches API call

Open shiftkey opened this issue 6 years ago • 0 comments

Please describe the problem you think should be solved

@niik raised an excellent point at the end of #7826

My only remaining concern now is with how we're dealing with failed API requests. Consumers of the fetchProtectedBranches method have no way of differentiating between an API request that returned zero protected branches and one that failed meaning that if we attempt to refresh the list of protected branches while there's no internet connectivity we'll immediately clear the internal list of protected branches. Given that this is a pre-existing behavior I don't think it should hold up this PR but I feel like it warrants further investigation to determine if that's the behavior we want.

[Optional] Do you have any potential solutions in mind?

We should preserve the list of cached protected branches if the API call fails due to an intermittent network issue. But I think we need to be mindful of other cases here (e.g. 404) and ensure the app handles them correctly.

shiftkey avatar Jun 25 '19 10:06 shiftkey