question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Octokat returns an empty string when connection is refused

See original GitHub issue

I 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

image

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:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
philschatzcommented, May 19, 2017

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:

  1. the Response object
  2. any parsed headers (like rate_limit and Link: headers needed for pagination)
  3. and the result

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.

1reaction
niikcommented, May 26, 2017

@niik was this how you were testing the behaviour? Or is there something else I should do in here?

Yup, that’s exactly how I was doing it

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTPResponse.read() returns empty string when response ...
Never mind; I'd misinterpreted the urllib3 API - urllib3.HTTPResponse.read() will return an empty string in that situation, but httplib.
Read more >
octokit/rest.js
You can set auth to a personal access token string. ... return true; } }, onSecondaryRateLimit: (retryAfter, options, octokit) => { // does...
Read more >
Authenticate with Octokit.net and push with LibGit2Sharp to ...
I use the LibGit2Sharp library to clone/push the authenticated user's GitHub repository, but LibGit2Sharp doesn't accept an access token to authorize the user....
Read more >
Plugin Gallery empty in OJS 3.1.2-1 - Software Support
Hi all, We recently updated our test OJS from 3.1.0.1 to 3.1.2.1. One of the problems that occured is that the plugin gallery...
Read more >
LOOT - Load Order Optimisation Tool - Nexus Mods
Setting the right load order for your mods is a crucial step to enjoying a stable modded game. The Load Order Optimisation Tool...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found