Skip to content

Commit 844e9f0

Browse files
committed
fix(@angular/cli): improve error message extraction for unfetchable packages
Use instanceof check and optional chaining fallback to properly extract error messages from Error instances and plain objects.
1 parent d349179 commit 844e9f0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/angular/cli/src/commands/update/schematic

packages/angular/cli/src/commands/update/schematic/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ export default function (options: UpdateSchema): Rule {
858858
// If the package cannot be fetched (e.g. private registry, JSR, AWS CodeArtifact,
859859
// or local workspace packages), return a partial object so the reduce below can
860860
// decide whether to warn or hard-fail based on whether it was explicitly requested.
861-
const message = (error as { message?: string }).message ?? String(error);
861+
const message = error instanceof Error ? error.message : (error as any)?.message ?? String(error);
862862
logger.warn(
863863
`Package '${depName}' could not be fetched from the registry: ${message}`,
864864
);

0 commit comments

Comments
 (0)