Skip to content

Commit 483ff58

Browse files
Merge pull request #293 from LambdaTest/Dot-3634
Dot 3634
2 parents 99b5251 + add62b3 commit 483ff58

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "4.1.11",
3+
"version": "4.1.12",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/tasks/createBuild.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
1111

1212
try {
1313
let resp = await ctx.client.createBuild(ctx.git, ctx.config, ctx.log, ctx.build.name, ctx.isStartExec, ctx.env.SMART_GIT, ctx.options.markBaseline, ctx.options.baselineBuild);
14-
ctx.build = {
15-
id: resp.data.buildId,
16-
name: resp.data.buildName,
17-
url: resp.data.buildURL,
18-
baseline: resp.data.baseline,
19-
useKafkaFlow: resp.data.useKafkaFlow || false,
14+
if (resp && resp.data && resp.data.buildId) {
15+
ctx.build = {
16+
id: resp.data.buildId,
17+
name: resp.data.buildName,
18+
url: resp.data.buildURL,
19+
baseline: resp.data.baseline,
20+
useKafkaFlow: resp.data.useKafkaFlow || false,
21+
}
22+
} else if (resp && resp.error) {
23+
if (resp.error.message) {
24+
ctx.log.error(`Error while creation of build: ${resp.error.message}`)
25+
throw new Error(`Error while creation of build: ${resp.error.message}`);
26+
}
2027
}
2128
task.output = chalk.gray(`build id: ${resp.data.buildId}`);
2229
task.title = 'SmartUI build created'

src/tasks/createBuildExec.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
1313
try {
1414
if (ctx.authenticatedInitially && !ctx.config.skipBuildCreation) {
1515
let resp = await ctx.client.createBuild(ctx.git, ctx.config, ctx.log, ctx.build.name, ctx.isStartExec, ctx.env.SMART_GIT, ctx.options.markBaseline, ctx.options.baselineBuild);
16-
ctx.build = {
17-
id: resp.data.buildId,
18-
name: resp.data.buildName,
19-
url: resp.data.buildURL,
20-
baseline: resp.data.baseline,
21-
useKafkaFlow: resp.data.useKafkaFlow || false,
16+
if (resp && resp.data && resp.data.buildId) {
17+
ctx.build = {
18+
id: resp.data.buildId,
19+
name: resp.data.buildName,
20+
url: resp.data.buildURL,
21+
baseline: resp.data.baseline,
22+
useKafkaFlow: resp.data.useKafkaFlow || false,
23+
}
24+
} else if (resp && resp.error) {
25+
if (resp.error.message) {
26+
ctx.log.error(`Error while creation of build: ${resp.error.message}`)
27+
throw new Error(`Error while creation of build: ${resp.error.message}`);
28+
}
2229
}
2330
if (ctx.build.id === '') {
2431
ctx.log.debug('Build creation failed: Build ID is empty');

0 commit comments

Comments
 (0)