Show error if debug log upload fails

pull/749/head
Scott Nonnenberg 7 years ago
parent eaf7f2d693
commit a195bf2e76

@ -356,6 +356,10 @@
"debugLogExplanation": { "debugLogExplanation": {
"message": "This log will be posted publicly online for contributors to view. You may examine and edit it before submitting." "message": "This log will be posted publicly online for contributors to view. You may examine and edit it before submitting."
}, },
"debugLogError": {
"message":
"Something went wrong with the upload! Please consider manually adding your log to the bug you file."
},
"reportIssue": { "reportIssue": {
"message": "Report an issue", "message": "Report an issue",
"description": "Link to open the issue tracker" "description": "Link to open the issue tracker"

@ -14,11 +14,18 @@ const USER_AGENT = `Signal Desktop ${VERSION}`;
// https://github.com/sindresorhus/got/pull/466 // https://github.com/sindresorhus/got/pull/466
const submitFormData = (form, url) => const submitFormData = (form, url) =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
form.submit(url, error => { form.submit(url, (error, response) => {
if (error) { if (error) {
return reject(error); return reject(error);
} }
const { statusCode } = response;
if (statusCode !== 204) {
return reject(
new Error(`Failed to upload to S3, got status ${statusCode}`)
);
}
return resolve(); return resolve();
}); });
}); });

@ -55,6 +55,7 @@
this.$('.buttons, textarea').remove(); this.$('.buttons, textarea').remove();
this.$('.result').addClass('loading'); this.$('.result').addClass('loading');
try {
const publishedLogURL = await window.log.publish(text); const publishedLogURL = await window.log.publish(text);
const view = new Whisper.DebugLogLinkView({ const view = new Whisper.DebugLogLinkView({
url: publishedLogURL, url: publishedLogURL,
@ -65,6 +66,14 @@
this.$('.link') this.$('.link')
.focus() .focus()
.select(); .select();
} catch (error) {
console.log(
'DebugLogView error:',
error && error.stack ? error.stack : error
);
this.$('.loading').removeClass('loading');
this.$('.result').text(i18n('debugLogError'));
}
}, },
}); });
})(); })();

Loading…
Cancel
Save