diff --git a/app/scripts/modules/core/src/orchestratedItem/orchestratedItem.transformer.spec.ts b/app/scripts/modules/core/src/orchestratedItem/orchestratedItem.transformer.spec.ts index 885c52324bc..2bca61a6ea2 100644 --- a/app/scripts/modules/core/src/orchestratedItem/orchestratedItem.transformer.spec.ts +++ b/app/scripts/modules/core/src/orchestratedItem/orchestratedItem.transformer.spec.ts @@ -41,7 +41,7 @@ describe('orchestratedItem transformer', () => { expect(getMessage({ context: {} })).toBe(null); }); - it('returns general exception even if a kato task is present', () => { + it('returns combined exception if both kato and general exceptions are present', () => { const stage = { context: { 'kato.tasks': [ @@ -61,7 +61,7 @@ describe('orchestratedItem transformer', () => { }, }, }; - expect(getMessage(stage)).toBe('E1\n\nE2'); + expect(getMessage(stage)).toBe('E1\n\nE2\n\nfailed!'); }); it('returns exception when it is in the last kato task', () => { diff --git a/app/scripts/modules/core/src/orchestratedItem/orchestratedItem.transformer.ts b/app/scripts/modules/core/src/orchestratedItem/orchestratedItem.transformer.ts index a593f007862..e5da0babaef 100644 --- a/app/scripts/modules/core/src/orchestratedItem/orchestratedItem.transformer.ts +++ b/app/scripts/modules/core/src/orchestratedItem/orchestratedItem.transformer.ts @@ -51,11 +51,7 @@ export class OrchestratedItemTransformer { Object.defineProperties(item, { failureMessage: { - get: (): string => - this.getCustomException(item) || - this.getGeneralException(item) || - this.getOrchestrationException(item) || - null, + get: (): string => this.mergeExceptions(item), }, isCompleted: { get: (): boolean => ['SUCCEEDED', 'SKIPPED'].includes(item.status), @@ -110,6 +106,18 @@ export class OrchestratedItemTransformer { }); } + private static mergeExceptions(item: any): string | null { + const exceptions = [ + this.getCustomException(item), + this.getGeneralException(item), + this.getOrchestrationException(item), + ].filter(it => !!it); + if (exceptions.length === 0) { + return null; + } + return exceptions.join('\n\n'); + } + private static getOrchestrationException(task: ITask): string { const katoTasks: any[] = task.getValueFor('kato.tasks'); if (katoTasks && katoTasks.length) {