Skip to content

Commit e740259

Browse files
committed
Simplify code
All errors returned by the fetch function should be of type FetchDocumentError. Since error wrapping is already handled in a lower-level function, there is no need to wrap the error again here.
1 parent 8fa65f2 commit e740259

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/archivist/fetcher/index.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,11 @@ export default async function fetch({
4848
executeClientScripts,
4949
};
5050

51-
try {
52-
if (executeClientScripts) {
53-
return await fetchWithFullDom(url, cssSelectors, fetcherConfig);
54-
}
55-
56-
return await fetchWithFallback(url, cssSelectors, fetcherConfig);
57-
} catch (error) {
58-
if (error.name !== 'FetchDocumentError') {
59-
throw new FetchDocumentError(error.message);
60-
}
61-
62-
throw error;
51+
if (executeClientScripts) {
52+
return fetchWithFullDom(url, cssSelectors, fetcherConfig);
6353
}
54+
55+
return fetchWithFallback(url, cssSelectors, fetcherConfig);
6456
}
6557

6658
async function fetchWithFallback(url, cssSelectors, fetcherConfig) {

0 commit comments

Comments
 (0)