diff --git a/static/js/services/build/build.service.impl.spec.ts b/static/js/services/build/build.service.impl.spec.ts index 48c5aa841..7fd08cd2d 100644 --- a/static/js/services/build/build.service.impl.spec.ts +++ b/static/js/services/build/build.service.impl.spec.ts @@ -37,6 +37,7 @@ describe("BuildServiceImpl", () => { beforeEach(() => { buildMessages = [ + {phase: null, message: ""}, {phase: 'cannot_load', message: 'Cannot load build status'}, {phase: 'starting', message: 'Starting Dockerfile build'}, {phase: 'initializing', message: 'Starting Dockerfile build'}, @@ -69,7 +70,7 @@ describe("BuildServiceImpl", () => { buildServiceImpl.getBuildMessage(phase); fail("Should throw error"); } catch (error) { - expect(error.message).toEqual("Invalid build phase"); + expect(error.message).toEqual(`Invalid build phase: ${phase.toString()}`); } }); }); diff --git a/static/js/services/build/build.service.impl.ts b/static/js/services/build/build.service.impl.ts index 05d08dd62..a65fb6a56 100644 --- a/static/js/services/build/build.service.impl.ts +++ b/static/js/services/build/build.service.impl.ts @@ -14,6 +14,10 @@ export class BuildServiceImpl implements BuildService { public getBuildMessage(phase: string): string { var message: string; switch (phase) { + case null: + message = ''; + break; + case 'cannot_load': message = 'Cannot load build status'; break; @@ -76,7 +80,7 @@ export class BuildServiceImpl implements BuildService { break; default: - throw new Error("Invalid build phase"); + throw new Error(`Invalid build phase: ${phase.toString()}`); } return message;