post status form error handling
This commit is contained in:
parent
7fc0765dc9
commit
d449701b84
3 changed files with 3 additions and 12 deletions
|
|
@ -635,11 +635,6 @@ const PostStatusForm = {
|
||||||
// Don't apply preview if not loading, because it means
|
// Don't apply preview if not loading, because it means
|
||||||
// user has closed the preview manually.
|
// user has closed the preview manually.
|
||||||
if (!this.previewLoading) return
|
if (!this.previewLoading) return
|
||||||
if (!data.error) {
|
|
||||||
this.preview = data
|
|
||||||
} else {
|
|
||||||
this.preview = { error: data.error }
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.preview = { error }
|
this.preview = { error }
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@ function humanizeErrors(errors) {
|
||||||
export function StatusCodeError(statusCode, body, options, response) {
|
export function StatusCodeError(statusCode, body, options, response) {
|
||||||
this.name = 'StatusCodeError'
|
this.name = 'StatusCodeError'
|
||||||
this.statusCode = statusCode
|
this.statusCode = statusCode
|
||||||
this.message =
|
this.details = JSON && JSON.stringify ? JSON.stringify(body) : body
|
||||||
statusCode + ' - ' + (JSON && JSON.stringify ? JSON.stringify(body) : body)
|
this.errorData = body.error
|
||||||
|
this.message = statusCode + ' - ' + body.error.error || body.error
|
||||||
this.error = body // legacy attribute
|
this.error = body // legacy attribute
|
||||||
this.options = options
|
this.options = options
|
||||||
this.response = response
|
this.response = response
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,6 @@ const postStatus = ({
|
||||||
|
|
||||||
return data
|
return data
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
|
||||||
return {
|
|
||||||
error: err.message,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const editStatus = ({
|
const editStatus = ({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue