Browse Source

Improved upload messages

Tobias Reich 9 years ago
parent
commit
761da1e936
1 changed files with 9 additions and 3 deletions
  1. 9 3
      src/scripts/upload.js

+ 9 - 3
src/scripts/upload.js

@@ -120,6 +120,9 @@ upload.start = {
 							.html('Failed')
 							.addClass('error')
 
+						// Throw error
+						if (error===true) lychee.error('Upload failed. Server returned an error!', xhr, xhr.responseText)
+
 					} else if (xhr.responseText.substr(0, 8)==='Warning:') {
 
 						errorText = xhr.responseText.substr(8)
@@ -130,6 +133,9 @@ upload.start = {
 							.html('Skipped')
 							.addClass('warning')
 
+						// Throw error
+						if (error===true) lychee.error('Upload failed. Server returned a warning!', xhr, xhr.responseText)
+
 					} else {
 
 						errorText = 'Server returned an unknown response. Please take a look at the console of your browser for further details.'
@@ -140,15 +146,15 @@ upload.start = {
 							.html('Failed')
 							.addClass('error')
 
+						// Throw error
+						if (error===true) lychee.error('Upload failed. Server returned an unkown error!', xhr, xhr.responseText)
+
 					}
 
 					$('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') p.notice')
 						.html(errorText)
 						.show()
 
-					// Throw error
-					if (error===true) lychee.error('Upload failed. Server returned the status code ' + xhr.status + '!', xhr, xhr.responseText)
-
 				}
 
 				// Check if there are file which are not finished