mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-23 10:18:40 +00:00
Merge pull request #634 from lucaperret/master
doc(XHRUpload): fix getResponseError signature
This commit is contained in:
commit
dbc9404139
1 changed files with 2 additions and 2 deletions
|
|
@ -106,7 +106,7 @@ getResponseData (xhr) {
|
|||
}
|
||||
```
|
||||
|
||||
### `getResponseError(xhr)`
|
||||
### `getResponseError(xhr.responseText, xhr)`
|
||||
|
||||
If the upload endpoint responds with a non-2xx status code, the upload is assumed to have failed.
|
||||
The endpoint might have responded with some information about the error, though.
|
||||
|
|
@ -115,7 +115,7 @@ Pass in a `getResponseError` function to extract error data from the `XMLHttpReq
|
|||
For example, if the endpoint responds with a JSON object containing a `{ message }` property, this would show that message to the user:
|
||||
|
||||
```js
|
||||
getResponseError (xhr) {
|
||||
getResponseError (responseText, xhr) {
|
||||
return new Error(JSON.parse(xhr.response).message)
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue