Skip to content

Commit

Permalink
fixup! throw errors if markdown fetching fails
Browse files Browse the repository at this point in the history
  • Loading branch information
PugzAreCute committed Aug 16, 2024
1 parent 6aebba8 commit ddc690f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/routes/wiki/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { error } from '@sveltejs/kit';

export async function load() {
const wiki_doc = `https://opendroid-docs-cdn.pugzarecute.com/wiki.md`;

const markdownFetch = await fetch(wiki_doc);

if(markdownFetch.status != 200) {
throw error(markdownFetch.status, markdownFetch.statusText);
}

const markdown = await markdownFetch.text();

return {
Expand Down
6 changes: 6 additions & 0 deletions src/routes/wiki/[...path]/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { error } from '@sveltejs/kit';

export async function load({ params }) {
const wiki_doc = `https://opendroid-docs-cdn.pugzarecute.com/wiki/${params.path}.md`;

const markdownFetch = await fetch(wiki_doc);

if(markdownFetch.status != 200) {
throw error(markdownFetch.status, markdownFetch.statusText);
}

const markdown = await markdownFetch.text();

return {
Expand Down

0 comments on commit ddc690f

Please sign in to comment.