Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling #13

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions app/src/info/ProjectInfoSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,14 @@ export default class ProjectInfoSet {
if ((!this._excludeTests || !this._excludeTests.includes(gen.id)) && gen && this.matchesSuite(gen)) {
GeneratorRegistrations.configureForSuite(gen, this.suite);

const results = await gen.generate(this.project);
try {
const results = await gen.generate(this.project);

for (const item of results) {
genItems.push(item);
for (const item of results) {
genItems.push(item);
}
} catch (e: any) {
genItems.push(new ProjectInfoItem(InfoItemType.internalProcessingError, gen.id, 500, e.toString()));
}
}
}
Expand All @@ -187,11 +191,14 @@ export default class ProjectInfoSet {

if ((!this._excludeTests || !this._excludeTests.includes(gen.id)) && this.matchesSuite(gen)) {
GeneratorRegistrations.configureForSuite(gen, this.suite);
try {
const results = await gen.generate(pi);

const results = await gen.generate(pi);

for (const item of results) {
genItems.push(item);
for (const item of results) {
genItems.push(item);
}
} catch (e: any) {
genItems.push(new ProjectInfoItem(InfoItemType.internalProcessingError, gen.id, 501, e.toString()));
}
}
}
Expand Down Expand Up @@ -1031,10 +1038,14 @@ function _addReportJson(data) {

for (const fileGen of fileGenerators) {
if (this.matchesSuite(fileGen)) {
const results = await fileGen.generate(project, file);
try {
const results = await fileGen.generate(project, file);

for (const item of results) {
genItems.push(item);
for (const item of results) {
genItems.push(item);
}
} catch (e: any) {
genItems.push(new ProjectInfoItem(InfoItemType.internalProcessingError, fileGen.id, 502, e.toString()));
}
}
}
Expand Down Expand Up @@ -1238,7 +1249,13 @@ function _addReportJson(data) {
await projectItem.load();

for (let j = 0; j < itemGenerators.length; j++) {
genItems = genItems.concat(await itemGenerators[j].generate(projectItem));
try {
genItems = genItems.concat(await itemGenerators[j].generate(projectItem));
} catch (e: any) {
genItems.push(
new ProjectInfoItem(InfoItemType.internalProcessingError, itemGenerators[j].id, 504, e.toString())
);
}
}

return genItems;
Expand Down
4 changes: 2 additions & 2 deletions app/src/info/TextureInfoGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default class TextureInfoGenerator implements IProjectInfoGenerator {
if (!terrainTexturesLeaf.includes(terrainTexture.textures)) {
terrainTexturesLeaf.push(terrainTexture.textures);
}
} else {
} else if (terrainTexture.textures) {
for (let str of terrainTexture.textures) {
if (!allTexturesLeaf.includes(str)) {
allTexturesLeaf.push(str);
Expand Down Expand Up @@ -188,7 +188,7 @@ export default class TextureInfoGenerator implements IProjectInfoGenerator {
if (!itemTexturesLeaf.includes(itemTexture.textures)) {
itemTexturesLeaf.push(itemTexture.textures);
}
} else {
} else if (itemTexture.textures) {
for (let str of itemTexture.textures) {
if (!allTexturesLeaf.includes(str)) {
allTexturesLeaf.push(str);
Expand Down