Skip to content

Commit

Permalink
chore: Add additional error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBaker committed Jun 17, 2021
1 parent 8024ea6 commit f6d52b9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/actions/check-for-outdated-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ const fetchFilesFromGH = async (url) => {
const resp = await fetch(nextPageLink, {
headers: { authorization: `token ${process.env.GITHUB_TOKEN}` },
});
if (!resp.ok) {
throw new Error(
`Github API returned status ${resp.code} - ${resp.message}`
);
}
const page = await resp.json();
nextPageLink = getNextLink(resp.headers.get('Link'));
files = [...files, ...page];
Expand Down Expand Up @@ -85,9 +90,8 @@ const checkOutdatedTranslations = async (url) => {

if (orphanedI18nFiles.length > 0) {
orphanedI18nFiles.forEach((f) =>
// TODO: improve output
console.log(
`ACTION NEEDED: Translation without english version found-- ${f.replace(
`ACTION NEEDED: Translation without english version found -> ${f.replace(
`${process.cwd()}/`,
''
)}`
Expand Down

0 comments on commit f6d52b9

Please sign in to comment.