Skip to content

refactor: Improve error log message when manifest.json is empty - #1667

Merged
d3xter666 merged 5 commits into
mainfrom
refactor-manifest-messages
Oct 21, 2026
Merged

d3xter666 merged 5 commits into
mainfrom
refactor-manifest-messages

Conversation

@d3xter666

Copy link
Copy Markdown
Member

JIRA: CPOUI5FOUNDATION-1046

Comment thread packages/builder/lib/utils/json.js Outdated
@d3xter666
d3xter666 force-pushed the refactor-manifest-messages branch 2 times, most recently from 15d0eb5 to 2e094a7 Compare October 20, 2026 07:06
Extend the parseJSON helper in project and builder packages to use
try/catch around JSON.parse, distinguishing empty content (ERR_EMPTY_JSON)
from malformed content (ERR_INVALID_JSON, thrown as SyntaxError).

Update manifest readers in Application and Component to re-throw
ERR_INVALID_JSON unwrapped, so the file path is preserved in the message
shown to users instead of being hidden behind a generic "Failed to read"
wrapper.
@d3xter666
d3xter666 force-pushed the refactor-manifest-messages branch from 2e094a7 to 85ac842 Compare October 20, 2026 07:50
@d3xter666
d3xter666 requested a review from RandomByte October 20, 2026 08:57
Comment thread packages/project/lib/specifications/types/Application.js Outdated
Comment thread packages/project/lib/specifications/types/Application.js Outdated
Comment thread packages/project/lib/specifications/types/Component.js Outdated
Comment thread packages/project/lib/specifications/types/Component.js
@d3xter666
d3xter666 force-pushed the refactor-manifest-messages branch from e9b7e4e to 54980c9 Compare October 21, 2026 05:05
@d3xter666
d3xter666 force-pushed the refactor-manifest-messages branch from 54980c9 to fca52ec Compare October 21, 2026 05:23
@d3xter666
d3xter666 requested a review from RandomByte October 21, 2026 07:58
@d3xter666
d3xter666 merged commit 538e946 into main Oct 21, 2026
77 checks passed
@d3xter666
d3xter666 deleted the refactor-manifest-messages branch October 21, 2026 15:04
d3xter666 added a commit that referenced this pull request Oct 22, 2026
JIRA: CPOUI5FOUNDATION-1046

This PR steps over and extends #1667. 

The reason behind this change is that besides it's not related to
`manifest.json` parsing, it follows the same pattern for handling empty
JSON files and providing more context in the error message.
Thus, we handle this edge case of parsing empty JSON files the same.

**Note:** There are special cases where an empty JSON is expected and is
handled explicitly. Those are not touched. i.e.
https://github.com/UI5/cli/blob/main/packages/builder/lib/processors/jsdoc/lib/createIndexFiles.js#L66-L68
d3xter666 added a commit to SAP/ui5-builder that referenced this pull request Oct 22, 2026
JIRA: CPOUI5FOUNDATION-1046

This PR steps over and extends UI5/cli#1667.

The reason behind this change is that besides it's not related to
manifest.json parsing, it follows the same pattern for handling empty
JSON files and providing more context in the error message.
Thus, we handle this edge case of parsing empty JSON files the same.
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.

2 participants