Skip to content

CreateRelease asserting on auth error. #230

Open
@bsutton

Description

@bsutton

I'm trying to use the CreateRelease class.

During my first test my code failed due to an auth error.

The problem is that the github library returned a secondary error masking the root cause of the problem.

repos_service: 993 - Failed assertion: boolean expression must not be null

Tracing through the code I believe the problem is caused in the github.requestJson method.

This method calls github.request with a 'null' statusCode.

In the request method I see the following code:

 _updateRateLimit(response.headers);
    if (statusCode != null && statusCode != response.statusCode) {
      if (fail != null) {
        fail(response);
      }
      handleStatusCode(response);
    } else {
      return response;
    }

My reading of this method is that if the statusCode is null then error is ignore.
The requestJson method then tries to decode the response as a CreateRelease object which of course its not.

I think the problem here is that the call to handleStatusCode is only called if a statusCode is passed in.

I would think that the handleStatusCode method should be called even if a statusCode is not passed in.

So I think the code should read:

 _updateRateLimit(response.headers);

      // handle expected status codes.
     if (statusCode != null && statusCode == response.statusCode) {
        return response;
    }
    /// should we consider any 2XX code to be an OK?
    if (response.statusCode != 200)
    {
        if (fail != null) {
           fail(response);
        handleStatusCode(response);
    } else {
      return response;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy