Handle unexpected sharing responses

This commit is contained in:
Mohammad Fares 2018-11-15 19:32:14 +02:00
parent 149190e964
commit f78ad0ab61

View File

@ -184,9 +184,6 @@ function shareRecording(context) {
return reject(error);
}
// Parse the response body
body = JSON.parse(body);
// Internal server error
if (response.statusCode == 500) {
return reject(body.errors.join('\n'));
@ -204,6 +201,14 @@ function shareRecording(context) {
return resolve();
}
// Unexpected error
if (response.statusCode != 200) {
return reject(new Error('Something went wrong, try again later'));
}
// Parse the response body
body = JSON.parse(body);
resolve(body.url);
});