Skip to content

fix(schematics): log the caught error when dataconnect.yaml parsing fails#3711

Open
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:fix/dataconnect-error-logging
Open

fix(schematics): log the caught error when dataconnect.yaml parsing fails#3711
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:fix/dataconnect-error-logging

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

Fixes #3710

One-line fix: the catch handler in parseDataConnectConfig names its error variable _ but logs e, which is undefined — so the intended soft-fail path (warn and return null) instead crashes the schematic with a ReferenceError. Renaming the variable to e makes the handler do what it was written to do.

No behavior change on the success path. The file isn't covered by any typecheck today (the library build excludes the schematics; esbuild doesn't check types), which is how this survived — a tsc --noEmit pass over src/schematics would catch this class of bug at build time.

…ails

The catch handler names its error variable _ but logs e, which is not
defined anywhere. When a malformed dataconnect.yaml lands in this
handler, evaluating e throws a ReferenceError from inside the catch —
so instead of warning and continuing with null, the whole schematic
crashes with an unrelated-looking error. Nothing typechecks this file
today (the library build excludes the schematics and esbuild does not
check types), which is how the undefined identifier survived.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ng add crashes with ReferenceError: e is not defined instead of warning when dataconnect.yaml cannot be parsed

2 participants