Skip to content

Turn 451 and 410 of the name and id lookups into Fbe::Error - #1312

Open
Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1227
Open

Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1227

Conversation

@Thayorns

Copy link
Copy Markdown
Contributor

repo_id_by_name, repo_name_by_id and user_name_by_id turned only a 404 and a 403 into Fbe::Error. GitHub also answers 451 for a repository under a DMCA takedown and 410 for some removed resources, and these came out as raw Octokit::UnavailableForLegalReasons and Octokit::Deprecated, while the callers expect Fbe::Error, as #1227 shows.

Now the three lookups also rescue these two errors and raise the same "is not accessible" Fbe::Error. I kept the list explicit instead of rescuing every Octokit::ClientError, so a rate limit error still reaches the caller as it is.

Six tests stub each lookup with a 451 and with a 410 and expect Fbe::Error.

Closes #1227

@Thayorns

Copy link
Copy Markdown
Contributor Author

@yegor256 take a look please, happy to clarify anything about this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repo_id_by_name, repo_name_by_id and user_name_by_id raise raw Octokit errors for 451 and 410

1 participant