Skip to content

Commit 81e3ee4

Browse files
try-catch around fetch
1 parent c407d6d commit 81e3ee4

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

movies/vanilla/src/example.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'dotenv/config';
22
import { v7 } from 'css-authn';
3-
import { fetchList } from './main.js';
3+
import { fetchList, Interpretation } from './main.js';
44

55
let authenticatedFetch: Awaited<ReturnType<typeof v7.getAuthenticatedFetch>>;
66

@@ -13,7 +13,15 @@ try {
1313
} catch(e) {
1414
console.log('Could not connect to your pod');
1515
}
16-
const listUrl = 'https://michielbdejong.solidcommunity.net/movies/';
17-
const interpretation = await fetchList(listUrl, authenticatedFetch);
16+
17+
let interpretation: Interpretation;
18+
try {
19+
20+
const listUrl = 'https://michielbdejong.solidcommunity.net/movies/';
21+
interpretation = await fetchList(listUrl, authenticatedFetch);
22+
} catch(e) {
23+
console.error('Could not fetch your movies folder');
24+
}
1825
interpretation.listings.forEach(listing => console.log(listing));
1926
interpretation.watchActions.forEach(watchAction => console.log(watchAction));
27+

0 commit comments

Comments
 (0)