mirror of
https://github.com/veggiemonk/awesome-docker.git
synced 2024-12-22 14:15:10 -05:00
Improve error logging
This commit is contained in:
parent
6e85932357
commit
6d070f8649
@ -137,13 +137,20 @@ const generate_GQL_query = (arr) =>
|
|||||||
// =============================================================
|
// =============================================================
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
const has_error = {
|
||||||
|
show: false,
|
||||||
|
duplicates: '',
|
||||||
|
other_links_error: '',
|
||||||
|
github_repos: '',
|
||||||
|
};
|
||||||
const markdown = await fs.readFile(README, 'utf8');
|
const markdown = await fs.readFile(README, 'utf8');
|
||||||
let links = extract_all_links(markdown);
|
let links = extract_all_links(markdown);
|
||||||
links = links.filter((l) => !exclude[l]); // exclude websites
|
links = links.filter((l) => !exclude[l]); // exclude websites
|
||||||
|
|
||||||
const duplicates = find_duplicates(links);
|
const duplicates = find_duplicates(links);
|
||||||
if (duplicates.length > 0) {
|
if (duplicates.length > 0) {
|
||||||
LOG.error_string({ duplicates });
|
has_error.show = true;
|
||||||
|
has_error.duplicates = duplicates;
|
||||||
}
|
}
|
||||||
const [github_links, other_links] = partition(links, (link) =>
|
const [github_links, other_links] = partition(links, (link) =>
|
||||||
link.startsWith('https://github.com'),
|
link.startsWith('https://github.com'),
|
||||||
@ -156,7 +163,8 @@ async function main() {
|
|||||||
BATCH_SIZE: 8,
|
BATCH_SIZE: 8,
|
||||||
});
|
});
|
||||||
if (other_links_error.length > 0) {
|
if (other_links_error.length > 0) {
|
||||||
LOG.error({ other_links_error });
|
has_error.show = true;
|
||||||
|
has_error.other_links_error = other_links_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const repos = extract_repos(github_links);
|
const repos = extract_repos(github_links);
|
||||||
@ -168,13 +176,19 @@ async function main() {
|
|||||||
|
|
||||||
const { data } = gql_response;
|
const { data } = gql_response;
|
||||||
if (gql_response.errors) {
|
if (gql_response.errors) {
|
||||||
LOG.error_string({ errors: gql_response.errors });
|
has_error.show = true;
|
||||||
|
has_error.github_repos = gql_response.errors;
|
||||||
|
}
|
||||||
|
if (has_error.show) {
|
||||||
|
LOG.error_string(has_error);
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
const repos_fetched = Object.entries(data)
|
|
||||||
.map(([, /* k , */ v]) => v.nameWithOwner)
|
|
||||||
.sort((a, b) => b - a);
|
|
||||||
|
|
||||||
console.log({ repos_fetched: repos_fetched.length });
|
// const repos_fetched = Object.entries(data)
|
||||||
|
// .map(([, /* k , */ v]) => v.nameWithOwner)
|
||||||
|
// .sort((a, b) => b - a);
|
||||||
|
|
||||||
|
console.log({ repos_fetched: data.length });
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('starting...');
|
console.log('starting...');
|
||||||
|
Loading…
Reference in New Issue
Block a user