Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not log errors unnecessarily #15456

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ export class RemoteIPyWidgetScriptManager extends BaseIPyWidgetScriptManager imp
protected async getWidgetScriptSource(script: Uri): Promise<string> {
const httpClientResponse = this.getWidgetScriptSourceUsingHttpClient(script);
const fetchResponse = this.getWidgetScriptSourceUsingFetch(script);
return httpClientResponse.catch(() => fetchResponse);
const promise = httpClientResponse.catch(() => fetchResponse);
// If we fail to download using both mechanisms, then log an error.
promise.catch((ex) => {
httpClientResponse.catch((ex) =>
traceError(`Failed to download widget script source from ${script.toString(true)}`, ex)
);
traceError(`Failed to download widget script source from ${script.toString(true)}`, ex);
});
return promise;
}
private async getWidgetScriptSourceUsingHttpClient(script: Uri): Promise<string> {
const uri = script.toString(true);
Expand All @@ -141,7 +149,6 @@ export class RemoteIPyWidgetScriptManager extends BaseIPyWidgetScriptManager imp
if (response.status === 200) {
return response.text();
} else {
traceError(`Error downloading from ${uri}: ${response.statusText}`);
throw new Error(`Error downloading from ${uri}: ${response.statusText}`);
}
}
Expand All @@ -154,7 +161,6 @@ export class RemoteIPyWidgetScriptManager extends BaseIPyWidgetScriptManager imp
if (response.status === 200) {
return response.text();
} else {
traceError(`Error downloading from ${uri} using custom fetch: ${response.statusText}`);
throw new Error(`Error downloading from ${uri} using custom fetch: ${response.statusText}`);
}
}
Expand Down
Loading