mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 20:07:49 +00:00
Ensure there is a response object before accessing its statusCode.
This commit is contained in:
@@ -146,10 +146,14 @@
|
|||||||
'auth': { 'user': username, 'pass': accessKey },
|
'auth': { 'user': username, 'pass': accessKey },
|
||||||
'json': testDefinition
|
'json': testDefinition
|
||||||
}, function(error, response, body) {
|
}, function(error, response, body) {
|
||||||
if (response.statusCode == 200) {
|
var statusCode = response && response.statusCode;
|
||||||
|
if (statusCode == 200) {
|
||||||
waitForTestCompletion(body);
|
waitForTestCompletion(body);
|
||||||
} else {
|
} else {
|
||||||
console.error('Failed to submit test to Sauce Labs; status ' + response.statusCode + ', body:\n' + JSON.stringify(body));
|
console.error('Failed to submit test to Sauce Labs; status: ' + statusCode + ', body:\n' + JSON.stringify(body));
|
||||||
|
if (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
process.exit(3);
|
process.exit(3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -160,7 +164,8 @@
|
|||||||
'auth': { 'user': username, 'pass': accessKey },
|
'auth': { 'user': username, 'pass': accessKey },
|
||||||
'json': testIdentifier
|
'json': testIdentifier
|
||||||
}, function(error, response, body) {
|
}, function(error, response, body) {
|
||||||
if (response.statusCode == 200) {
|
var statusCode = response && response.statusCode;
|
||||||
|
if (statusCode == 200) {
|
||||||
if (body.completed) {
|
if (body.completed) {
|
||||||
logInline('');
|
logInline('');
|
||||||
handleTestResults(body['js tests']);
|
handleTestResults(body['js tests']);
|
||||||
@@ -173,7 +178,10 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logInline('');
|
logInline('');
|
||||||
console.error('Failed to check test status on Sauce Labs; status ' + response.statusCode + ', body:\n' + JSON.stringify(body));
|
console.error('Failed to check test status on Sauce Labs; status: ' + statusCode + ', body:\n' + JSON.stringify(body));
|
||||||
|
if (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
process.exit(4);
|
process.exit(4);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user