Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed script termination when an API fork compare returns '404 Not Found' #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,12 @@ async function fetchMoreDir(repo, originalBranch, fork, fromOriginal, api) {
});
const data = await api.fetch(url, limiter);

if (fromOriginal)
fork.diff_from_original = printInfo('-', data, fork);
else
fork.diff_to_original = printInfo('+', data, fork);
if (data !== null) {
if (fromOriginal)
fork.diff_from_original = printInfo('-', data, fork);
else
fork.diff_to_original = printInfo('+', data, fork);
}
}

function printInfo(sep, data, fork) {
Expand Down Expand Up @@ -368,6 +370,8 @@ function Api(token) {
const response = await fetch(url, newConfig);
if (response.status === 304)
return cached.data;
if (response.status === 404)
return null;
if (!response.ok)
throw Error(response.statusText);

Expand Down