browser: Return a more descriptive error for HTTP 500 (#5112)

This commit is contained in:
Harshavardhana 2017-10-27 15:09:14 -07:00 committed by Dee Koder
parent 6400f506da
commit b4ddccc2f7
2 changed files with 39 additions and 29 deletions

View File

@ -482,7 +482,7 @@ export const uploadFile = (file, xhr) => {
})) }))
xhr.onload = function(event) { xhr.onload = function(event) {
if (xhr.status == 401 || xhr.status == 403 || xhr.status == 500) { if (xhr.status == 401 || xhr.status == 403) {
setShowAbortModal(false) setShowAbortModal(false)
dispatch(stopUpload({ dispatch(stopUpload({
slug slug
@ -492,6 +492,16 @@ export const uploadFile = (file, xhr) => {
message: 'Unauthorized request.' message: 'Unauthorized request.'
})) }))
} }
if (xhr.status == 500) {
setShowAbortModal(false)
dispatch(stopUpload({
slug
}))
dispatch(showAlert({
type: 'danger',
message: xhr.responseText
}))
}
if (xhr.status == 200) { if (xhr.status == 200) {
setShowAbortModal(false) setShowAbortModal(false)
dispatch(stopUpload({ dispatch(stopUpload({

File diff suppressed because one or more lines are too long