Skip to content

Commit a4802b6

Browse files
authored
Merge pull request #4 from sushobhit-lt/stage
handle screenshot name validations and build errors
2 parents d375882 + ac3d2d0 commit a4802b6

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/cli/src/validate.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ export function validateScreenshotConfig(configFile, options, log) {
4040

4141
//Check for URLs should not be empty
4242
for (const screenshot of screenshots) {
43+
if (!screenshot.name || screenshot.name == '') {
44+
log.error(`Error: Missing screenshot name in ${configFile}`);
45+
process.exit(ABNORMAL_EXIT);
46+
}
4347
if (!screenshot.url || screenshot.url == '') {
44-
log.error('Error: Missing required URL for screenshot');
48+
log.error('Error: Missing required URL for screenshot : '+screenshot.name);
4549
process.exit(ABNORMAL_EXIT);
4650
}
4751
//Check for URLs should valid (like abcd in URL)

packages/core/src/client.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,16 @@ function postRequest(url, body, options, log) {
115115
return response && response.data
116116
})
117117
.catch(function (error) {
118+
log.debug(error);
118119
if (error && error.response && error.response.data) {
119-
log.debug(error.response.data);
120-
log.info('Build Creation Failed');
121-
return error.response.data;
122-
}
123-
if (error.response) {
120+
log.error('Build Creation Failed');
121+
log.error(error.response.data)
122+
} else if (error.response) {
124123
log.error('Build creation failed: response: ', error.response.data.error?.message);
125124
} else {
126125
log.error('Build creation failed: Error: ', error);
127126
}
128-
process.exitCode = constants.ABNORMAL_EXIT;
127+
process.exit(constants.ABNORMAL_EXIT);
129128
})
130129
}
131130

0 commit comments

Comments
 (0)