Skip to content

Commit

Permalink
Fix deployment errors parsing when no tip found
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Dec 31, 2024
1 parent 60d4f23 commit 6b8eeb8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/common/utils/deployTipJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ export async function analyzeDeployErrorLogsJson(resultJson: any, log: string, i
tips.push(tipDefinition);
}
}
// Add default tip if not found
if (error.tips.length === 0) {
error.message = stripAnsi(error.messageInitial);
const errorBase = Object.assign({}, error);
delete errorBase.tips;
error.tips.push({
error: errorBase
});
}
}

// Enrich with AI if applicable
Expand Down Expand Up @@ -69,7 +78,7 @@ export async function analyzeDeployErrorLogsJson(resultJson: any, log: string, i
const detailedErrorLines: string[] = [];
for (const error of errors) {
detailedErrorLines.push(...["", c.red(c.bold(error.messageInitialDisplay)), ""]);
if (error.tips.length > 0) {
if (error.tips.length > 0 && error.tips.some(err => err.tip)) {
for (const errorTip of error.tips) {
detailedErrorLines.push(...[
c.yellow(c.italic("Error " + c.bold(errorTip.tip.label)) + ":"),
Expand Down

0 comments on commit 6b8eeb8

Please sign in to comment.