Skip to content

Commit ce271fc

Browse files
authored
Improve error message when fetch fails (#310)
1 parent 1b2626d commit ce271fc

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vscode-docker-registries/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.1 - 14 October 2025
2+
### Fixed
3+
* Better error messages in the tree when errors occur. [#310](https://github.com/microsoft/vscode-docker-extensibility/pull/310)
4+
15
## 0.4.0 - 6 October 2025
26
### Added
37
* Package is now a combined CJS+ESM package, instead of just CJS. [#297](https://github.com/microsoft/vscode-docker-extensibility/pull/297)

packages/vscode-docker-registries/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@microsoft/vscode-docker-registries",
33
"author": "Microsoft Corporation",
4-
"version": "0.4.0",
4+
"version": "0.4.1",
55
"description": "Extensibility model for contributing registry providers to the Container Tools extension for Visual Studio Code",
66
"license": "See LICENSE in the project root for license information.",
77
"repository": {

packages/vscode-docker-registries/src/clients/Common/ErrorTreeItem.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,21 @@ export function getErrorTreeItem(error: unknown, parent: CommonRegistryItem | un
2424
} as RegistryConnectError];
2525
}
2626

27+
let message: string | undefined;
28+
if (typeof error === 'string') {
29+
message = error;
30+
} else if (error instanceof Error && !!error.message) {
31+
if (!!error.cause && error.cause instanceof Error && !!error.cause.message) {
32+
message = `${error.message}: ${error.cause.message}`;
33+
} else {
34+
message = error.message;
35+
}
36+
}
37+
2738
// Otherwise, return a generic error
2839
return [{
2940
parent: parent,
30-
label: error instanceof Error ? error.message : vscode.l10n.t('Unknown error'),
41+
label: message ?? vscode.l10n.t('Unknown error'),
3142
type: 'commonerror',
3243
}];
3344
}

0 commit comments

Comments
 (0)