Skip to content

getConfigFile() throws error instead of returning emptyConfigResult when file does not exist #257

Open
@andy-crain-kr

Description

@andy-crain-kr

What happened?

When a specified file does not exist, getConfigFile() is supposed to return an emptyConfigResult object. But when the non-existent file is requested, octokit.request throws an error that has {...status: "404" }, while getConfigFile() is anticipating 404 (integer) instead of "404" (string), and so instead of returning emptyConfigResult, it instead throws the error.

What did you expect to happen?

I would expect that when a file does not exist, an emptyConfigResult object is returned.

What the problem might be

The test:

    if (error.status === 404) {
      return emptyConfigResult;
    }

should instead be:

    if (error.status === "404") {
      return emptyConfigResult;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions