Skip to content

Commit 43c6b22

Browse files
authored
[FIX] Application: Fallback to manifest.appdescr_variant if manifest.json is not found (#631)
This fixes a regression presumably present since ui5-project v3.0.0, which prevented proper fallback to manifest.appdescr_variant in case no manifest.json is found in the project.
1 parent 557cb36 commit 43c6b22

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/specifications/types/Application.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,16 @@ class Application extends ComponentProject {
214214
return this._pManifests[filePath] = this._getRawSourceReader().byPath(filePath)
215215
.then(async (resource) => {
216216
if (!resource) {
217-
throw new Error(
217+
const error = new Error(
218218
`Could not find resource ${filePath} in project ${this.getName()}`);
219+
error.code = "ENOENT"; // "File or directory does not exist"
220+
throw error;
219221
}
220222
return JSON.parse(await resource.getString());
221223
}).catch((err) => {
224+
if (err.code === "ENOENT") {
225+
throw err;
226+
}
222227
throw new Error(
223228
`Failed to read ${filePath} for project ` +
224229
`${this.getName()}: ${err.message}`);

test/lib/specifications/types/Application.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,10 @@ test.serial("_getManifest: File does not exist", async (t) => {
583583
const project = await Specification.create(projectInput);
584584

585585
const error = await t.throwsAsync(project._getManifest("/does-not-exist.json"));
586-
t.deepEqual(error.message,
587-
"Failed to read /does-not-exist.json for project application.a: " +
586+
t.is(error.message,
588587
"Could not find resource /does-not-exist.json in project application.a",
589588
"Rejected with correct error message");
589+
t.is(error.code, "ENOENT");
590590
});
591591

592592
test.serial("_getManifest: result is cached", async (t) => {

0 commit comments

Comments
 (0)