Octokat returns an empty string when connection is refused
See original GitHub issueI added an entry to my hosts file to stop all trafic to api.github.com
and then tried to launch the app. It didn’t work.
Turns out that when a request in Octokat fails du to a connection refused error the only thing we get back is an empty string. No error, no nothing.
This is even more disconcerting given that the whole octokat client is untyped (any
) so we tell blatant lies to the type system.
Take this example
We assert that we return a readonly array of emails when in fact we might end up returning an empty string if there’s a connection error.
We probably need to go fix this in octokat and then make sure that we deal with the ensuing errors because right now we’re hiding potential incoherent state.
I’ll open up a PR shortly to take work around the blockers that prevent the app from launching but we’ll need a better strategy for this, and soon.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Howdy! I’m the developer of Octokat.
https://github.com/philschatz/octokat.js/pull/170 switches Octokat to use the
fetch
API directly which might help with this problem. You can test it by using the pre-release versionv0.9.0-0
.If that does not work, I will probably need to switch Octokat to yield an object that contains:
Response
objectrate_limit
andLink:
headers needed for pagination)Those would be breaking changes but I could probably fix up
desktop
.It may take a little while to make those changes since I work on Octokat in my spare time.
Regarding typescript definitions, that would be a great feature; I can try that once the
response.status == 0
is working for you.Yup, that’s exactly how I was doing it