Skip to content

Commit fbc0de0

Browse files
author
tomzu
committed
renamed to throwOnError
1 parent d6f8e77 commit fbc0de0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/core/src/shared/lsp/lspResolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export class LanguageServerResolver {
226226
res: await new HttpResourceFetcher(content.url, {
227227
showUrl: true,
228228
timeout: timeout,
229-
swallowError: false,
229+
throwOnError: true,
230230
}).get(),
231231
hash: content.hashes[0],
232232
filename: content.filename,

packages/core/src/shared/resourcefetcher/httpResourceFetcher.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ export class HttpResourceFetcher implements ResourceFetcher<Response> {
2222
* @param {string} params.friendlyName If URL is not shown, replaces the URL with this text.
2323
* @param {Timeout} params.timeout Timeout token to abort/cancel the request. Similar to `AbortSignal`.
2424
* @param {number} params.retries The number of retries a get request should make if one fails
25-
* @param {boolean} params.swallowError True if we want to swallow the request error, false if we want the error to keep bubbling up
25+
* @param {boolean} params.throwOnError True if we want to throw if there's request error, defaul to false
2626
*/
2727
public constructor(
2828
private readonly url: string,
2929
private readonly params: {
3030
showUrl: boolean
3131
friendlyName?: string
3232
timeout?: Timeout
33-
swallowError?: boolean
33+
throwOnError?: boolean
3434
}
3535
) {
36-
this.params.swallowError = this.params.swallowError ?? true
36+
this.params.throwOnError = this.params.throwOnError ?? false
3737
}
3838

3939
/**
@@ -86,10 +86,10 @@ export class HttpResourceFetcher implements ResourceFetcher<Response> {
8686
`Error downloading ${this.logText()}: %s`,
8787
error.message ?? error.code ?? error.response.statusText ?? error.response.status
8888
)
89-
if (this.params.swallowError) {
90-
return undefined
89+
if (this.params.throwOnError) {
90+
throw error
9191
}
92-
throw error
92+
return undefined
9393
}
9494
}
9595

0 commit comments

Comments
 (0)