Skip to content

Octokat returns an empty string when connection is refused #1522

Closed

Description

@niik

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.

Activity

  1. added this to the M5: Post-Beta Bougie milestone on May 16, 2017
  2. shiftkey commented on May 16, 2017

    @shiftkey
    Member

    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.

    👍 they've been pretty great at taking in our changes already, so I think they'd be open to improving this as well

  3. added
    tech-debt
    on May 17, 2017
  4. philschatz commented on May 19, 2017

    @philschatz

    Howdy! I'm the developer of Octokat.

    philschatz/octokat.js#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.

  5. niik commented on May 19, 2017

    @niik
    MemberAuthor

    @philschatz Switching to fetch sounds like a wonderful plan, thanks for letting us know about it!

  6. shiftkey commented on May 25, 2017

    @shiftkey
    Member

    Updating to 0.9.0-1 seems to yield better errors from the fetch API:

    screen shot 2017-05-25 at 1 24 39 pm

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

  7. self-assigned this
    on May 25, 2017
  8. shiftkey commented on May 25, 2017

    @shiftkey
    Member

    Picking this one up as I think updating to 0.9.0 will help here

  9. niik commented on May 26, 2017

    @niik
    MemberAuthor

    @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

  10. locked as resolved and limited conversation to collaborators on Jul 22, 2018
  11. unlocked this conversation on Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementtech-debt

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions