Skip to content

Commit

Permalink
fix: add error logging for download failures and page loading issues
Browse files Browse the repository at this point in the history
  • Loading branch information
maehr committed Oct 11, 2024
1 parent 27351dd commit 1d15ec6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/downloadManager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ class DownloadManager {
if (!response.ok) throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
await pipelineAsync(response.body, fs.createWriteStream(path.join(outputPath, fileName)));
console.log(`Downloaded ${url} to ${path.join(outputPath, fileName)}`);
} catch (error) {
} catch (e) {
if (retries > 0) {
console.error(e);
console.log(`Retrying download for ${url}. Retries left: ${retries - 1}`);
await this.download(url, staticDir, retries - 1);
} else {
Expand Down
1 change: 1 addition & 0 deletions src/routes/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export async function load() {
meta: page.metadata
};
} catch (e) {
console.error(e);
error(404, `Could not find startseite.md`);
}
}
1 change: 1 addition & 0 deletions src/routes/[slug]/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export async function load({ params }) {
meta: page.metadata
};
} catch (e) {
console.error(e);
error(404, `Could not find ${params.slug}`);
}
}
1 change: 1 addition & 0 deletions src/routes/blog/[slug]/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export async function load({ params }) {
meta: post.metadata
};
} catch (e) {
console.error(e);
error(404, `Could not find ${params.slug}`);
}
}
1 change: 1 addition & 0 deletions src/routes/blog/kategorie/[slug]/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export async function load({ fetch, params }) {
posts: filteredPosts
};
} catch (e) {
console.error(e);
error(404, `Could not find ${params.slug}`);
}
}
1 change: 1 addition & 0 deletions src/routes/partner/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
label: feature.properties.label,
name: feature.properties.name
}));
// eslint-disable-next-line no-unused-vars
let selectedFeature = null;
function flyToFeature(feature, zoomLevel = 18) {
Expand Down

0 comments on commit 1d15ec6

Please sign in to comment.