-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Show error page if upload fails #168
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ $(document).ready(function() { | |
$('#file-list').show(); | ||
$('#upload-progress').hide(); | ||
$('#share-link').hide(); | ||
$('#upload-error').hide(); | ||
|
||
if (localStorage.length === 0) { | ||
toggleHeader(); | ||
|
@@ -46,6 +47,7 @@ $(document).ready(function() { | |
$('#file-list').show(); | ||
$('#upload-progress').hide(); | ||
$('#share-link').hide(); | ||
$('#upload-error').hide(); | ||
$copyBtn.attr('disabled', false); | ||
$copyBtn.html('Copy'); | ||
}); | ||
|
@@ -66,35 +68,44 @@ $(document).ready(function() { | |
$('#page-one').hide(); | ||
$('#file-list').hide(); | ||
$('#upload-progress').show(); | ||
$('#upload-error').hide(); | ||
$('#upload-filename').innerHTML += file.name; | ||
// update progress bar | ||
document | ||
.querySelector('#progress-bar') | ||
.style.setProperty('--progress', percentComplete + '%'); | ||
$('#progress-text').html(`${percentComplete}%`); | ||
}); | ||
fileSender.upload().then(info => { | ||
const url = info.url.trim() + `#${info.secretKey}`.trim(); | ||
$('#link').attr('value', url); | ||
const fileData = { | ||
name: file.name, | ||
fileId: info.fileId, | ||
url: info.url, | ||
secretKey: info.secretKey, | ||
deleteToken: info.deleteToken, | ||
creationDate: new Date(), | ||
expiry: expiration | ||
}; | ||
localStorage.setItem(info.fileId, JSON.stringify(fileData)); | ||
|
||
$('#page-one').hide(); | ||
$('#file-list').hide(); | ||
$('#upload-progress').hide(); | ||
$('#share-link').show(); | ||
|
||
populateFileList(JSON.stringify(fileData)); | ||
notify('Your upload has finished.'); | ||
}); | ||
fileSender | ||
.upload() | ||
.then(info => { | ||
const url = info.url.trim() + `#${info.secretKey}`.trim(); | ||
$('#link').attr('value', url); | ||
const fileData = { | ||
name: file.name, | ||
fileId: info.fileId, | ||
url: info.url, | ||
secretKey: info.secretKey, | ||
deleteToken: info.deleteToken, | ||
creationDate: new Date(), | ||
expiry: expiration | ||
}; | ||
localStorage.setItem(info.fileId, JSON.stringify(fileData)); | ||
|
||
$('#page-one').hide(); | ||
$('#file-list').hide(); | ||
$('#upload-progress').hide(); | ||
$('#share-link').show(); | ||
$('#upload-error').hide(); | ||
|
||
populateFileList(JSON.stringify(fileData)); | ||
notify('Your upload has finished.'); | ||
}) | ||
.catch(err => { | ||
console.log('Upload error name: ' + err); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, are these errors logged and sent through Raven at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is a bit more tricky: if the user accidentally tampers with the salt, this error would trigger. Is that something we would want to send to Raven? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that only sending the error to Raven here is sufficient? This will eliminate any duplicates, since errors from the |
||
$('#page-one').hide(); | ||
$('#upload-error').show(); | ||
}); | ||
}; | ||
|
||
window.allowDrop = function(ev) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnarcese @abhinadduri Are these errors logged and sent through Raven?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, should be fairly easy to send them to Raven though.