1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Merge pull request #28 from ascribe/AD-1340-add-details-video-upload-errors

Add additional logging to video upload errors
This commit is contained in:
Tim Daubenschütz 2015-11-16 16:34:03 +01:00
commit 9d0b4fcd6e
2 changed files with 28 additions and 14 deletions

View File

@ -410,13 +410,15 @@ let ReactS3FineUploader = React.createClass({
}, },
onComplete(id, name, res, xhr) { onComplete(id, name, res, xhr) {
// there has been an issue with the server's connection // There has been an issue with the server's connection
if((xhr && xhr.status === 0) || res.error) { if (xhr && xhr.status === 0 && res.success) {
console.logGlobal(new Error(res.error || 'Complete was called but there wasn\t a success'), false, { console.logGlobal(new Error('Upload succeeded with a status code 0'), false, {
files: this.state.filesToUpload, files: this.state.filesToUpload,
chunks: this.state.chunks chunks: this.state.chunks,
xhr: this.getXhrErrorComment(xhr)
}); });
} else { // onError will catch any errors, so we can ignore them here
} else if (!res.error || res.success) {
let files = this.state.filesToUpload; let files = this.state.filesToUpload;
// Set the state of the completed file to 'upload successful' in order to // Set the state of the completed file to 'upload successful' in order to
@ -467,10 +469,11 @@ let ReactS3FineUploader = React.createClass({
this.onError(null, null, err.message); this.onError(null, null, err.message);
}, },
onError(id, name, errorReason) { onError(id, name, errorReason, xhr) {
console.logGlobal(errorReason, false, { console.logGlobal(errorReason, false, {
files: this.state.filesToUpload, files: this.state.filesToUpload,
chunks: this.state.chunks chunks: this.state.chunks,
xhr: this.getXhrErrorComment(xhr)
}); });
this.props.setIsUploadReady(true); this.props.setIsUploadReady(true);
@ -480,6 +483,17 @@ let ReactS3FineUploader = React.createClass({
GlobalNotificationActions.appendGlobalNotification(notification); GlobalNotificationActions.appendGlobalNotification(notification);
}, },
getXhrErrorComment(xhr) {
if (xhr) {
return {
response: xhr.response,
url: xhr.responseURL,
status: xhr.status,
statusText: xhr.statusText
};
}
},
isFileValid(file) { isFileValid(file) {
if(file.size > this.props.validation.sizeLimit) { if(file.size > this.props.validation.sizeLimit) {

View File

@ -8683,7 +8683,7 @@ qq.s3.RequestSigner = function(o) {
options.log(errorMessage, "error"); options.log(errorMessage, "error");
} }
promise.failure(errorMessage); promise.failure(errorMessage, xhrOrXdr);
} }
else { else {
promise.success(response); promise.success(response);
@ -8815,7 +8815,7 @@ qq.s3.RequestSigner = function(o) {
credentialsProvider.get().accessKey, credentialsProvider.get().accessKey,
credentialsProvider.get().sessionToken); credentialsProvider.get().sessionToken);
}, function(errorMsg) { }, function(errorMsg) {
options.log("Attempt to update expired credentials apparently failed! Unable to sign request. ", "error"); options.log("Attempt to update expired credentials apparently failed! Unable to sign request: " + errorMsg, "error");
signatureEffort.failure("Unable to sign request - expired credentials."); signatureEffort.failure("Unable to sign request - expired credentials.");
}); });
} }
@ -9629,8 +9629,8 @@ qq.s3.XhrUploadHandler = function(spec, proxy) {
}); });
xhr.send(chunkData.blob); xhr.send(chunkData.blob);
}, function() { }, function(errorMsg, xhr) {
promise.failure({error: "Problem signing the chunk!"}, xhr); promise.failure({error: "Problem signing the chunk: " + errorMsg}, xhr);
}); });
return promise; return promise;
@ -9674,10 +9674,10 @@ qq.s3.XhrUploadHandler = function(spec, proxy) {
uploadIdPromise.success(uploadId); uploadIdPromise.success(uploadId);
promise.success(uploadId); promise.success(uploadId);
}, },
function(errorMsg) { function(errorMsg, xhr) {
handler._getPersistableData(id).uploadId = null; handler._getPersistableData(id).uploadId = null;
promise.failure(errorMsg); promise.failure(errorMsg, xhr);
uploadIdPromise.failure(errorMsg); uploadIdPromise.failure(errorMsg, xhr);
} }
); );
} }